Module: Executor::GridFTPStorage

Defined in:
lib/hyperflow-amqp-executor/gridftp_storage.rb

Instance Method Summary collapse

Instance Method Details

#stage_inObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/hyperflow-amqp-executor/gridftp_storage.rb', line 8

def stage_in
  @job.inputs.each do |file|
      local_file_name = @workdir + "/" + file.name
      url = @job.options.prefix + "/" + file.name
      
      Executor::logger.debug "[#{@id}] Downloading #{url} to #{local_file_name}"
      stdout, stderr, status = Open3.capture3({'X509_USER_PROXY' => @proxy_file}, 'globus-url-copy', url, local_file_name, chdir: @workdir)
      unless status == 0
        raise Exception, "Failed downloading input from GridFTP, status: #{status}\nstdout:\n#{stdout}\n\n stderr:\n#{stderr}"
      end
  end
end

#stage_outObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hyperflow-amqp-executor/gridftp_storage.rb', line 21

def stage_out
  @job.outputs.each do |file|
    local_file_name = @workdir + "/" + file.name
    url = @job.options.prefix + "/" + file.name

    Executor::logger.debug "[#{@id}] Uploading #{file.name} to #{url}"
    stdout, stderr, status = Open3.capture3({'X509_USER_PROXY' => @proxy_file}, 'globus-url-copy', local_file_name, url, chdir: @workdir)
    unless status == 0
      raise Exception, "Failed uploading input from GridFTP, status: #{status}\nstdout:\n#{stdout}\n\n stderr:\n#{stderr}"
    end
  end
end

#storage_initObject

Raises:

  • (Exception)


3
4
5
6
# File 'lib/hyperflow-amqp-executor/gridftp_storage.rb', line 3

def storage_init
  raise Exception, "Unable to locate user proxy certificate" if Executor::settings.plgdata.proxy.nil? or !File.exists?(Executor::settings.plgdata.proxy)
  @proxy_file = Executor::settings.gridftp.proxy
end

#workdir(&block) ⇒ Object



34
35
36
# File 'lib/hyperflow-amqp-executor/gridftp_storage.rb', line 34

def workdir(&block)
  Dir::mktmpdir(&block)
end