Class: Etna::Clients::Metis::IngestMetisDataWorkflow

Inherits:
Struct
  • Object
show all
Defined in:
lib/etna/clients/metis/workflows/ingest_metis_data_workflow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ingest_filesystemObject

Returns the value of attribute ingest_filesystem

Returns:

  • (Object)

    the current value of ingest_filesystem



8
9
10
# File 'lib/etna/clients/metis/workflows/ingest_metis_data_workflow.rb', line 8

def ingest_filesystem
  @ingest_filesystem
end

#loggerObject

Returns the value of attribute logger

Returns:

  • (Object)

    the current value of logger



8
9
10
# File 'lib/etna/clients/metis/workflows/ingest_metis_data_workflow.rb', line 8

def logger
  @logger
end

#metis_filesystemObject

Returns the value of attribute metis_filesystem

Returns:

  • (Object)

    the current value of metis_filesystem



8
9
10
# File 'lib/etna/clients/metis/workflows/ingest_metis_data_workflow.rb', line 8

def metis_filesystem
  @metis_filesystem
end

Instance Method Details

#copy_file(dest:, src:) ⇒ Object



23
24
25
26
27
# File 'lib/etna/clients/metis/workflows/ingest_metis_data_workflow.rb', line 23

def copy_file(dest:, src:)
  ingest_filesystem.with_readable(src, "r") do |file|
    metis_filesystem.do_streaming_upload(file, dest, file.size)
  end
end

#copy_files(srcs) ⇒ Object

Since we are doing manual triage of files,

do not automatically copy directory trees.

srcs must be a list of full paths to files.



12
13
14
15
16
17
18
19
20
21
# File 'lib/etna/clients/metis/workflows/ingest_metis_data_workflow.rb', line 12

def copy_files(srcs)
  srcs.each do |src|
    next unless ingest_filesystem.exist?(src)

    logger&.info("Copying file #{src} (#{Etna::Formatting.as_size(ingest_filesystem.stat(src).size)})")

    # For ingestion triage, just copy over the exact path + filename.
    copy_file(dest: src, src: src)
  end
end