Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Conversation

@michael-paddle
Copy link

@michael-paddle michael-paddle commented Oct 4, 2018

I would like to see the ability to run a one shot task and then ensure that it should finish. This PR is a proof of concept for a wait command that waits for a task to have completed.

This is a PR with some code that I wrote that enables me to do that. Since it's my first attempt at programming in go you might want to treat it more as a proposal than a PR, however if you like the design but have comments then I'm more than willing to work to clean up the code. Alternatively, if there's a way to do this that I missed please do tell.

There are two situations I think would be good to have

  # run task and wait for it complete - not yet supported
  fargate task run -w uploadtask
  # now run something that depends on the task completing.
  s3_verify_upload 

and

  #run task then do something else - this is what I have provided
  fargate task run uploadtask
  ec2_fix_permissions_to_allow_web_access
  #check that the task has actually finished
  fargate  task wait 
  s3_verify_upload 

Bugs

  • sometimes it seems that tasks hang for some time after finishing so the wait time can be quite long; I think that's just the way things work
  • no timeout currently implemented though it could be trivially done if anyone's interested and I will probably need it soon
  • the waiting is verbose which I will fix soon
  • if you keep starting tasks under the same task name then it will not terminate till all such tasks terminate - this is currently more feature than bug.

@osterman
Copy link

osterman commented Oct 5, 2018

I think this is a great proposal, but suggest altering the implementation. Instead, it would be nice if there were a --wait flag for each command that would make it synchronous. This is how the helm tool works for kubernetes. For example, what drew me to this page was I wanted to do fargate certificate validate $DOMAIN --wait, so that when that completes I create the service.

@michael-paddle
Copy link
Author

@osterman I totally agree that would be better. For now the current way of doing it suits what I'm working on but if I get a message from @jpignata that he would accept the patches I will code the feature as you described.

@PaulMaddox
Copy link
Contributor

I'm closing this as it's been open and stale for a long time.
Sync waits do seem like a useful feature, however I do not think that this is the optimal implementation.

@PaulMaddox PaulMaddox closed this Sep 5, 2019
@danielfosbery danielfosbery deleted the mdlr-wait-command branch December 11, 2019 15:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants