Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Cromshell support for non-interactive setup #224

Open
mbookman opened this issue Nov 3, 2022 · 8 comments
Open

FR: Cromshell support for non-interactive setup #224

mbookman opened this issue Nov 3, 2022 · 8 comments

Comments

@mbookman
Copy link

mbookman commented Nov 3, 2022

in order to use cromshell, I need to at some point interactively run cromshell to answer a few questions.
The only question that actually needs to be answered is what the Cromwell server URL is; the other prompts are simply confirmation dialogs.

It should be possible to call:

cromshell update-server [URL]

For example:

cromshell update-server localhost:8000
@jonn-smith
Copy link
Collaborator

Cromshell just creates a dot folder in the user's home directory and stores settings in there.

Is there a reason you can't query and update the dotfile that contains the server info?

@mbookman
Copy link
Author

mbookman commented Nov 3, 2022

We can manually work around this by writing the ~/.cromshell/cromwell_server.config file. That is what we are doing today.

However cromshell should either document the file and the format and expressly support people updating it directly (it could be listed in the getting started instructions), or provide a way for setting the value through the tool non-interactively. This feature request is for doing the latter, but either way is fine.

Happy to submit a PR for either approach.

@jonn-smith
Copy link
Collaborator

jonn-smith commented Nov 3, 2022

The documentation should definitely be updated.

As for the feature, it turns out we already have a command to update the server that I forgot about: update-server. I think that will do what you need. You can't directly query with it I don't think, but this will let you set it programmatically.

I'm a dummy and misunderstood your question. Yeah - this is a good idea.

@SHuang-Broad
Copy link
Contributor

sounds like a sub-command (e.g. print-config) could be useful and not so hard to implement, for cromshell 2.0.

@bshifaw thoughts?

@bshifaw
Copy link
Collaborator

bshifaw commented Nov 4, 2022

cromshell2.0 creates a config file if it doesn't find it and asks the user to update it, which can also be updated via update-server. Wouldn't be a problem to add that print-config subcommand

@SHuang-Broad
Copy link
Contributor

We can place that under "community feature requests" then.

@mbookman
Copy link
Author

mbookman commented Nov 4, 2022

I just want to be clear on the original request; I'm unclear how we landed on the print-config command. I'm not opposed to it, but it wasn't the original request.

The original request is to be able to set the URL for Cromshell programmatically and not interactively. Today with cromshell on the master branch, when you run the "update-server" command, the following gets executed:

  # Use the update-server sub-command to modify CROMWELL_NEEDS_SETUP here.
  if [[ "${SUB_COMMAND}" == "update-server" ]] ; then
    CROMWELL_NEEDS_SETUP=true
  fi
  
  # Check if we need to set this up.
  # Note: because of how `notify` works, we can't require the setup for the notify action.
  if ${CROMWELL_NEEDS_SETUP} && [[ "${SUB_COMMAND}" != "notify" ]] ; then
    # We need to setup this install.
    # Now let's set it up:
    which dialog &> /dev/null
    r=$?
     if [[ ${r} -eq 0 ]] ; then
      setupCromshellDialog
    else
      setupCromshell
    fi
    exit 0
  fi

I'd like to be able to call:

cromshell update-server localhost:8000

and not go through any prompts.

@jonn-smith
Copy link
Collaborator

@mbookman Yup - I got it. I think we need both commands / options.

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

No branches or pull requests

4 participants