app/models/logical/naf/log_parser/runner.rb in naf-2.0.0 vs app/models/logical/naf/log_parser/runner.rb in naf-2.0.1
- old
+ new
@@ -33,11 +33,23 @@
def parse_newest_log
"#{newest_log.scan(/\d{4}.*\.\d{3}/).first} #{newest_log.scan(/Process.*/).first.try(:split, '<br>').try(:first)}"
end
def retrieve_log_files_from_s3
- s3_log_reader.runner_log_files(record_id)
+ uuids = ::Naf::MachineRunner.
+ joins(:machine_runner_invocations).
+ where("#{Naf.schema_name}.machine_runners.id = ?", record_id).
+ pluck("#{Naf.schema_name}.machine_runner_invocations.uuid")
+
+ files = []
+ s3_log_reader.runner_log_files.each do |file|
+ if uuids.include?(file.scan(UUID_REGEX).first)
+ files << file
+ end
+ end
+
+ files
end
def get_invocation_id(uuid)
if invocations_ids[uuid].blank?
@invocations_ids[uuid] = ::Naf::MachineRunnerInvocation.find_by_uuid(uuid).id
@@ -48,10 +60,10 @@
def get_files
if log_type == 'old' && read_from_s3 == 'true'
get_s3_files do
@s3_log_reader = ::Logical::Naf::LogReader.new
- return s3_log_reader.runner_log_files(record_id)
+ return retrieve_log_files_from_s3
end
else
files = Dir["#{::Naf::PREFIX_PATH}/#{::Naf.schema_name}/runners/*/*"]
if files.present?
# Sort log files based on time