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

cli: easy deletion of pods #103

Merged
merged 1 commit into from
Oct 11, 2018
Merged

Conversation

roksys
Copy link
Contributor

@roksys roksys commented Oct 10, 2018

Signed-off-by: Rokas Maciulaitis rokas.maciulaitis@cern.ch

@ghost ghost assigned roksys Oct 10, 2018
@ghost ghost added the Status: in review label Oct 10, 2018
@roksys roksys force-pushed the pods-deletion branch 2 times, most recently from 5c5af36 to 3643235 Compare October 10, 2018 14:33
reana/cli.py Outdated
if component in COMPONENT_PODS:
cmd = 'kubectl delete pod -l app={0}'.format(
COMPONENT_PODS[component])
run_command(cmd)
Copy link
Member

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
Copy link
Member

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(
Copy link
Member

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>
@tiborsimko tiborsimko merged commit 6c14a88 into reanahub:master Oct 11, 2018
@ghost ghost removed the Status: in review label Oct 11, 2018
@roksys roksys deleted the pods-deletion branch October 11, 2018 12:46
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