chaps-io/gush

bundle exec viz workflow with parameters

lefterisnik opened this issue · 6 comments

How can I run viz for a workflow with parameters?

When I try to run viz I am getting:

ArgumentError: wrong number of arguments (given 0, expected 1)

My workflow is:

class AssessmentWorkflow < Gush::Workflow
  def configure(assessment_id)
    run Job1, params: {assessment_id: assessment_id}
    run Job2, params: {assessment_id: assessment_id}, after: Job1
    run Job3, params: {assessment_id: assessment_id}, after: Job2
  end
end

Hey, this is not currently possible from the command line.

To do it the command would have to accept parameters as JSON, the same way actual workflows get it.

Thanks @pokonski for your answer. Could you provide an example?

You could do it manually inside your app via:

      workflow = AssessmentWorkflow.new(some_argument)
      graph = Gush::Graph.new(workflow)
      graph.viz
      Launchy.open graph.path

This is pretty much what CLI does here: https://github.com/chaps-io/gush/blob/master/lib/gush/cli.rb#L85

Glad I could help ✌️

@lefterisnik I encountered the same problem and I just set a default argument temporarily for it to work. Though, it would be useful for someone.

class Workflow < Gush::Workflow
  def configure(argument = 'default temporary') # Temp argument here
    ...
  end
end