-
Notifications
You must be signed in to change notification settings - Fork 54
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
cli: easy deletion of pods #103
Conversation
5c5af36
to
3643235
Compare
reana/cli.py
Outdated
if component in COMPONENT_PODS: | ||
cmd = 'kubectl delete pod -l app={0}'.format( | ||
COMPONENT_PODS[component]) | ||
run_command(cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use run_command(cmd, component)
so that the output messages wwould be more informative (will print the leading component in brackets as usual for other commands)
reana/cli.py
Outdated
@@ -157,7 +169,7 @@ def cli(): # noqa: D301 | |||
$ cd reana-job-controller | |||
$ reana-dev git-checkout -b . 72 --fetch | |||
$ reana-dev docker-build -c . | |||
$ kubectl delete pod -l app=job-controller | |||
$ reana-dev kubectl-delete-pod -c reana-job-controller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use -c .
in the help here, so that it mirrors docker-build -c .
command above. Basically .
means current working directory, so that people don't have to type much the component name....
reana/cli.py
Outdated
components = select_components(component) | ||
for component in components: | ||
if component in COMPONENT_PODS: | ||
cmd = 'kubectl delete pod -l app={0}'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add --wait=false
to the command options for faster action.
Otherwise this command waits for pod deletion. Keeping our developer-oriented use case, I think we may want to return as soon as possible. This would permit to plug the command into your editing pipeline, e.g. edit some file in r-j-c
, save it, which would automatically trigger pod deletion via this command... and we wouldn't want our editors to wait. We could use asynchronous OS process for this, but adding --wait=false
seems just as good and simpler.
$ time kubectl delete pod -l app=job-controller
pod "job-controller-5fcb4c5c9c-djscz" deleted
kubectl delete pod -l app=job-controller 0.09s user 0.01s system 0% cpu 32.204 total
$ time kubectl delete pod --wait=false -l app=job-controller
pod "job-controller-5fcb4c5c9c-fhhqk" deleted
kubectl delete pod --wait=false -l app=job-controller 0.15s user 0.03s system 111% cpu 0.159 total
* Adds new command for easier deletion of pods. Closes reanahub#100 Signed-off-by: Rokas Maciulaitis <rokas.maciulaitis@cern.ch>
Signed-off-by: Rokas Maciulaitis rokas.maciulaitis@cern.ch