Class: Tumugi::Workflow
- Inherits:
-
Object
- Object
- Tumugi::Workflow
- Defined in:
- lib/tumugi/workflow.rb
Constant Summary collapse
- DEFAULT_CONFIG_FILE =
"tumugi_config.rb"
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #add_task(id, task) ⇒ Object
- #execute(command, root_task_id, options) ⇒ Object
- #find_task(id) ⇒ Object
-
#initialize ⇒ Workflow
constructor
A new instance of Workflow.
Constructor Details
#initialize ⇒ Workflow
Returns a new instance of Workflow.
18 19 20 21 22 |
# File 'lib/tumugi/workflow.rb', line 18 def initialize @id = SecureRandom.uuid @tasks = {} @params = {} end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'lib/tumugi/workflow.rb', line 13 def id @id end |
#params ⇒ Object
Returns the value of attribute params.
14 15 16 |
# File 'lib/tumugi/workflow.rb', line 14 def params @params end |
Instance Method Details
#add_task(id, task) ⇒ Object
33 34 35 |
# File 'lib/tumugi/workflow.rb', line 33 def add_task(id, task) @tasks[id.to_s] = task end |
#execute(command, root_task_id, options) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/tumugi/workflow.rb', line 24 def execute(command, root_task_id, ) (command, ) load_workflow_file([:file]) dag = create_dag(root_task_id) command_module = Kernel.const_get("Tumugi").const_get("Command") cmd = command_module.const_get("#{command.to_s.capitalize}").new cmd.execute(dag, ) end |
#find_task(id) ⇒ Object
37 38 39 40 41 |
# File 'lib/tumugi/workflow.rb', line 37 def find_task(id) task = @tasks[id.to_s] raise Tumugi::TumugiError, "Task not found: #{id}" if task.nil? task end |