Sha256: 13d41012d3ffb74ad679765cdd0d42adb09f97ed24daee1d992648a23e271361
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'vx/message' require 'vx/common' module Vx module Worker class Job attr_reader :output, :message, :output_counter def initialize(perform_job_message) @output_counter = 0 @message = perform_job_message @output = Common::OutputBuffer.new(&method(:publish_job_log_message)) end def add_to_output(str) output << str end def instrumentation { job_id: message.job_id, build_id: message.id } end def add_command_to_output(cmd) add_to_output "$ #{cmd}\n" end def add_trace_to_output(log) add_to_output log.split(/\n/).map{|i| " ===> #{i}\n" }.join end def release output.close end def publish_job_log_message(str) @output_counter += 1 log = Message::JobLog.new( build_id: message.id, job_id: message.job_id, tm: output_counter, log: str ) JobLogsConsumer.publish( log, headers: { build_id: log.build_id, job_id: log.job_id } ) log end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vx-worker-0.3.0.pre1 | lib/vx/worker/job.rb |