Skip to content

Conversation

@mly32
Copy link
Owner

@mly32 mly32 commented Dec 7, 2022

summary

Adds a script in scripts/util to simplify running cascade_server, cascade_client, and cascade_fuse_client.

The available flags are:

  -h            Print this message and exit.
  -d    D       CFG directory location (defaults to cfg).
  -n    N       Sets a range from 0..N-1 for range commands.
  -u    K       update key in range.
  -v    V       update value in range.
                (ex. -n 7 -u default_log_level -v info)
  -k            Kill running cascade nodes.
  -r            Remove old logs in range.
  -s            Start server nodes in range.
  -f    D       directory to mount (requires -c flag to start and -k to end).
  -c    I       Start client node at folder cfg/nI.

example usage:

cascade_runner --help # see usage
cascade_runner -d ./cfg  -n 7 -u default_log_level -v info # change log level to info
cascade_runner -d ./cfg -n 4 -s # start server node in n0 to n3
ps # view they started properly
cascade_runner -d ./cfg -c 5 # start client in n5
cascade_runner -d ./cfg -c 5 -f fcc # start fuse client in n5, mounting to fcc
ls fcc
ps # view fuse client
cascade_runner -d ./cfg -k -f fcc # kill fuse client (and unmount at location)
ps
cascade_runner -d ./cfg -k # kill server nodes
ps

notes

This PR also changes src/service/server.cpp, the cascade server, to have the option to quit on SIGINT (just like how the fuse client quits). To not break any existing usage, it is enabled through the --signal flag. Without it, the cascade server will quit on <Enter> as usual.

This change was added because, without it, usage of the cascade runner script involves some complicated sleep logic to avoid sending input that would trigger the cascade server process to end.

See: https://stackoverflow.com/questions/9575473/running-a-process-that-waits-on-input-in-the-background-without-it-pausing-and. The working sleep logic is commented out in the cascade runner script in case the --signal flag should not be added.

The changed files in the src/service/fuse folder are from formatting (clang-format) and typo fixes. There are no semantic changes.

improvements

  • Currently, the servers are killed using pkill -SIGINT. A safer way would be to store the PIDs in a file and kill them that way.
  • Since the server nodes are running as background processes, the stdout is written to a node_info.log file for viewing. This should be configurable.
  • The script updates the PATH envvar with the binaries from build-Release, which may not be necessary.
  • The config files are getting updated through a naive regex find and replace. A safer replacement would be using tools like jq and dasel to modify the configs. The config looks like a mix of toml with some json in some of the values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants