Commit ff0fea02 authored by Samir Noir's avatar Samir Noir 🧀
Browse files

Add missing workdir parameter when calling OAR's API

OAR's API use the workdir parameter to define where to put the
oarapi.subscript file.
parent 9d0adc42
Pipeline #189792 passed with stages
in 22 minutes
...@@ -27,7 +27,7 @@ module Grid5000 ...@@ -27,7 +27,7 @@ module Grid5000
# OAR expects these as import-job-key-from-file # OAR expects these as import-job-key-from-file
READ_ONLY_UNDERSCORE_ATTRIBUTES = [:import_job_key_from_file].freeze READ_ONLY_UNDERSCORE_ATTRIBUTES = [:import_job_key_from_file].freeze
READ_WRITE_ATTRIBUTES = %i[name project].freeze READ_WRITE_ATTRIBUTES = %i[name project workdir].freeze
attr_reader(*READ_ONLY_ATTRIBUTES) attr_reader(*READ_ONLY_ATTRIBUTES)
attr_reader(*READ_ONLY_UNDERSCORE_ATTRIBUTES) attr_reader(*READ_ONLY_UNDERSCORE_ATTRIBUTES)
attr_accessor(*READ_WRITE_ATTRIBUTES) attr_accessor(*READ_WRITE_ATTRIBUTES)
...@@ -61,6 +61,7 @@ module Grid5000 ...@@ -61,6 +61,7 @@ module Grid5000
value = instance_variable_get "@#{integer_field}" value = instance_variable_get "@#{integer_field}"
instance_variable_set "@#{integer_field}", value.to_i unless value.nil? instance_variable_set "@#{integer_field}", value.to_i unless value.nil?
end end
@workdir = @directory
@on_launch = {} if @on_launch.nil? @on_launch = {} if @on_launch.nil?
end end
...@@ -75,7 +76,7 @@ module Grid5000 ...@@ -75,7 +76,7 @@ module Grid5000
h['property'] = properties unless properties.nil? || properties.empty? h['property'] = properties unless properties.nil? || properties.empty?
h['type'] = types unless types.nil? || types.empty? h['type'] = types unless types.nil? || types.empty?
%w[walltime queue directory name project signal checkpoint stderr stdout].each do |prop| %w[walltime queue directory name project signal checkpoint stderr stdout workdir].each do |prop|
value = instance_variable_get "@#{prop}" value = instance_variable_get "@#{prop}"
h[prop] = value unless value.nil? h[prop] = value unless value.nil?
end end
......
...@@ -82,7 +82,8 @@ describe Grid5000::Job do ...@@ -82,7 +82,8 @@ describe Grid5000::Job do
'command' => '', 'command' => '',
'project' => 'default', 'project' => 'default',
'properties' => "(deploy = 'YES') AND desktop_computing = 'NO'", 'properties' => "(deploy = 'YES') AND desktop_computing = 'NO'",
'state' => 'running' 'state' => 'running',
'workdir' => '/home/grenoble/rchakode'
}) })
end end
it 'should export to a hash structure valid for submitting a job to the oarapi' do it 'should export to a hash structure valid for submitting a job to the oarapi' do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment