Skip to content

Commit

Permalink
submit/apply should be non-interactive
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Mar 6, 2023
1 parent 9a97a62 commit 4cbd05e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ jobs:
minikube delete
cd ${workdir}
flux-cloud up --cloud minikube --force-cluster
flux-cloud --debug submit
flux-cloud --debug submit --non-interactive
flux-cloud down --cloud minikube
18 changes: 16 additions & 2 deletions docs/getting_started/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,14 @@ Apply is going to be creating on CRD per job, so that's a lot of
pod creation and deletion. This is in comparison to "submit" that
brings up a MiniCluster once, and then executes commands to it, allowing
Flux to serve as the scheduler. Note that by default, we always wait for a previous run to be cleaned up
before continuing.
before continuing. If you don't want apply to be interactive (e.g., it will
ask you before cleaning up) you can do:

```bash
$ flux-cloud apply --non-interactive
```

By default, apply via a "run" is non-interactive.

#### run

Expand Down Expand Up @@ -299,7 +306,14 @@ to submit jobs. For submit (and the equivalent to bring it up and down with batc
your commands aren't provided in the CRD,
but rather to the Flux Restful API. Submit / batch will also generate one CRD
per MiniCluster size, but use the same MiniCluster across jobs. This is different
from apply, which generates one CRD per job to run.
from apply, which generates one CRD per job to run. If you don't want submit to be interactive
(e.g., it will ask you before cleaning up) you can do:

```bash
$ flux-cloud submit --non-interactive
```

By default, submit run with batch is non-interactive.

#### batch

Expand Down
9 changes: 9 additions & 0 deletions fluxcloud/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ def get_parser():
help="Bring down all experiment clusters",
dest="down_all",
)
for command in submit, apply:
command.add_argument(
"--non-interactive",
"--ni",
default=False,
action="store_true",
help="Don't ask before bringing miniclusters down or re-creating.",
dest="non_interactive",
)

experiment = subparsers.add_parser(
"experiment",
Expand Down
4 changes: 2 additions & 2 deletions fluxcloud/client/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def main(args, parser, extra, subparser):
apply parser submits via separate CRDs.
"""
cli, setup, experiment = prepare_client(args, extra)
cli.apply(setup, experiment=experiment)
cli.apply(setup, experiment=experiment, interactive=not args.non_interactive)
setup.cleanup(setup.matrices)


Expand All @@ -20,5 +20,5 @@ def submit(args, parser, extra, subparser):
submit parser submits via the Flux Restful API to one cluster
"""
cli, setup, experiment = prepare_client(args, extra)
cli.submit(setup, experiment=experiment)
cli.submit(setup, experiment=experiment, interactive=not args.non_interactive)
setup.cleanup(setup.matrices)
4 changes: 2 additions & 2 deletions fluxcloud/main/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def run(self, setup):
# Each experiment has its own cluster size and machine type
for experiment in setup.iter_experiments():
self.up(setup, experiment=experiment)
self.apply(setup, experiment=experiment)
self.apply(setup, experiment=experiment, interactive=False)
self.down(setup, experiment=experiment)

@save_meta
Expand All @@ -83,7 +83,7 @@ def batch(self, setup):
# Each experiment has its own cluster size and machine type
for experiment in setup.iter_experiments():
self.up(setup, experiment=experiment)
self.submit(setup, experiment=experiment)
self.submit(setup, experiment=experiment, interactive=False)
self.down(setup, experiment=experiment)

@save_meta
Expand Down

0 comments on commit 4cbd05e

Please sign in to comment.