Class: Mortar::Command::Luigi
- Includes:
- Git
- Defined in:
- lib/mortar/command/luigi.rb
Overview
run luigi pipeline jobs
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#index ⇒ Object
luigi SCRIPT.
Methods inherited from Base
#api, #ask_public, #config_parameters, #get_error_message_context, #git, #initialize, #initialize_embedded_project, #luigi_parameters, namespace, #pig_parameters, #project, #register_api_call, #register_do, #register_project, #spark_script_arguments, #validate_project_name, #validate_project_structure
Methods included from Helpers
#action, #ask, #confirm, #copy_if_not_present_at_dest, #default_host, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #display_with_indent, #download_to_file, #ensure_dir_exists, #error, error_with_failure, error_with_failure=, extended, extended_into, #format_bytes, #format_date, #format_with_bang, #full_host, #get_terminal_environment, #home_directory, #host, #hprint, #hputs, included, included_into, #installed_with_omnibus?, #json_decode, #json_encode, #line_formatter, #longest, #output_with_bang, #pending_github_team_state_message, #quantify, #redisplay, #retry_on_exception, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #test_name, #ticking, #time_ago, #truncate, #warning, #with_tty, #write_to_file
Constructor Details
This class inherits a constructor from Mortar::Command::Base
Instance Method Details
#index ⇒ Object
luigi SCRIPT
Run a luigi pipeline.
-P, –project PROJECTNAME # Use a project that is not checked out in the current directory. Runs code from project’s master branch in GitHub rather than snapshotting local code. -B, –branch BRANCHNAME # Used with –project to specify a non-master branch
Examples:
Run the nightly_rollup luigiscript:
$ mortar luigi luigiscripts/nightly_rollup.py
Run the nightly_rollup luigiscript with two parameters:
$ mortar luigi luigiscripts/nightly_rollup.py --data-date 2012-02-01 --my-param myval
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/mortar/command/luigi.rb', line 41 def index script_name = shift_argument unless script_name error("Usage: mortar luigi SCRIPT\nMust specify SCRIPT.") end if [:project] project_name = [:project] if File.extname(script_name) == ".py" script_name = File.basename(script_name, ".*") end else project_name = project.name script = validate_luigiscript!(script_name) script_name = script.name end parameters = luigi_parameters() if [:project] if [:branch] git_ref = [:branch] else git_ref = "master" end else git_ref = sync_code_with_cloud() end # post job to API response = action("Requesting job execution") do api.post_luigi_job(project_name, script_name, git_ref, :project_script_path => script.rel_path, :parameters => parameters).body end display("job_id: #{response['job_id']}") display display("Job status can be viewed on the web at:\n\n #{response['web_job_url']}") display response['job_id'] end |