Class: Patriot::Command::CompositeCommand
- Inherits:
-
CommandGroup
- Object
- Base
- CommandGroup
- Patriot::Command::CompositeCommand
- Defined in:
- lib/patriot/command/composite.rb
Overview
a command which is composed of multiple sub commands
Constant Summary
Constants included from Util::Config
Util::Config::ADMIN_USER_KEY, Util::Config::DEFAULT_CONFIG, Util::Config::DEFAULT_PLUGIN_DIR, Util::Config::INFO_SERVER_PORT_KEY, Util::Config::PASSWORD_KEY, Util::Config::PLUGIN_DIR_KEY, Util::Config::PLUGIN_INIT_SCRIPT, Util::Config::PLUGIN_KEY, Util::Config::PLUGIN_LIB_DIR, Util::Config::USERNAME_KEY, Util::Config::WORKER_HOST_KEY, Util::Config::WORKER_USER_KEY
Instance Attribute Summary
Attributes inherited from CommandGroup
Attributes inherited from Base
#config, #parser, #post_processors, #start_datetime, #target_datetime, #test_mode
Instance Method Summary collapse
-
#configure ⇒ Object
configure this composite command.
- #description ⇒ Object
-
#execute ⇒ Object
execute the contained commands.
-
#job_id ⇒ String
The identifier of this composite command.
Methods inherited from CommandGroup
Methods inherited from Base
#[], #_HH_, #_date_, #_hour_, #_month_, #add_post_processor, #add_subcommand, #build, #command_name, #configure_attr, #initialize, #param, #produce, #require, #skip, #start_date_time, #suspend, #to_job, #validate_command_attrs
Methods included from CommandMacro
#add_dsl_function, #command_attr, #command_attrs, #declare_command_name, #private_command_attr, #serde_attrs, #validate_attr, #validate_existence, #validation_logics, #volatile_attr, #volatile_attrs
Methods included from Util::Logger
Methods included from Util::Config
Methods included from Util::DateUtil
#date_add, #date_add_year, #date_format, #date_sub, #date_sub_year, #date_to_month, #days_of_month, #days_of_month_until, #days_of_week, #hours, #month_add, #month_sub, #to_date_obj, #to_end_of_last_month, #to_end_of_month, #to_month, #to_start_of_month
Methods included from Util::Param
Methods included from Parser
#batch_macro, #import_erb_config, #load_macro, #new_command, #parse
Constructor Details
This class inherits a constructor from Patriot::Command::CommandGroup
Instance Method Details
#configure ⇒ Object
configure this composite command. pull up required/produced products from the sub commands
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/patriot/command/composite.rb', line 26 def configure @name_suffix ||= _date_ # don't do flatten to handle nested composite commands @subcommands.map do |cmd| cmd = cmd.clone cmd.build(@param).each do |cmd| _validate_command(cmd) require cmd['requisites'] produce cmd['products'] @contained_commands << cmd end end return self end |
#description ⇒ Object
17 18 19 20 21 |
# File 'lib/patriot/command/composite.rb', line 17 def description first_job = @contained_commands.first first_job = first_job.description unless first_job.nil? return "#{first_job} ... (#{@contained_commands.size} jobs)" end |
#execute ⇒ Object
execute the contained commands
43 44 45 46 47 |
# File 'lib/patriot/command/composite.rb', line 43 def execute @contained_commands.each do |c| c.execute end end |
#job_id ⇒ String
Returns the identifier of this composite command.
12 13 14 |
# File 'lib/patriot/command/composite.rb', line 12 def job_id return "#{command_name}_#{@name}_#{@name_suffix}" end |