Class: PatriotGCP::Command::GCSCommand
- Inherits:
-
Patriot::Command::Base
- Object
- Patriot::Command::Base
- PatriotGCP::Command::GCSCommand
show all
- Includes:
- Ext::GCS
- Defined in:
- lib/patriot_gcp/command/gcs.rb
Defined Under Namespace
Classes: GCSException, GoogleCloudPlatformException
Instance Method Summary
collapse
Methods included from Ext::GCS
#gcs, included
Instance Method Details
18
19
20
21
22
23
|
# File 'lib/patriot_gcp/command/gcs.rb', line 18
def configure
if @name_suffix == _date_
raise ArgumentError, 'To set _date_ only is not allowed here to avoid job name duplication.'
end
self
end
|
#execute ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/patriot_gcp/command/gcs.rb', line 25
def execute
@logger.info "start gcs #{@command}"
ini = IniFile.load(@inifile)
if ini.nil?
raise Exception, "inifile not found"
end
gcs_keyfile = ini["gcp"]["gcs_keyfile"]
stat_info = gcs(
gcs_keyfile,
@project_id,
@bucket,
@command,
@source_file,
@dest_file
)
@logger.info "gcs #{@command} execution succeeded: #{stat_info}"
@logger.info "end gcs #{@command}"
end
|
#job_id ⇒ Object
13
14
15
|
# File 'lib/patriot_gcp/command/gcs.rb', line 13
def job_id
"#{command_name}_#{@command}_#{@project_id}_#{@bucket}_#{@name_suffix}"
end
|