chaps-io / gush

Fast and distributed workflow runner using ActiveJob and Redis
MIT License
1.04k stars 104 forks source link

Depend on user input #5

Closed benoist closed 9 years ago

benoist commented 9 years ago

Hi,

I've had a look at your workflow gem. It looks really clean and neat. I do have a question about depending on user input. I've got some workflows that require user input in the middle of the flow. Is there any way to specify in the workflow, that an external update is required? I understand that this requires me to explicitly push the object in de workflow to the next state after the user input is received.

Cheers, Benoist

pokonski commented 9 years ago

Hi Benoist, this isn't quite possible as Gush uses sidekiq for job processing and that is executed in background.

If input is expected through a web-app for example, you could make a job which waits as long as it needs to until the input appears (in the database for example). Doing it through CLI is not possible with sidekiq.

benoist commented 9 years ago

I was thinking more in the line of processing the job until user input is required. The worker updates a state to mark a request for user input either through a web app or some other input. When the input is received the job is rescheduled and continues the flow. Essentially is creating 2+ workflow objects and combining them into 1 main flow.

pokonski commented 9 years ago

Well, that would be a good way and can be done already in the current state of Gush.

stevenharman commented 9 years ago

What about user input to even start the job? e.g., say I wanted to start a whole workflow to publish a book... I'd need to know what book to even publish. How would I pass that into the workflow?

pokonski commented 9 years ago

@stevenharman good point. That's what I'm working on now. Passing arguments to workflow, from which you can customize dependencies and pass more arguments down the line.

Will ping you once I push those changes :)

pokonski commented 9 years ago

@stevenharman took a bit, but the workflows with arguments are now on master :)

Check it out and I'd love to hear some feedback :point_right: https://github.com/pokonski/gush#passing-arguments-to-workflows

stevenharman commented 9 years ago

@pokonski Looking good! Thanks!