Class: Siding::Worker
- Inherits:
-
Object
- Object
- Siding::Worker
- Defined in:
- lib/siding/worker.rb
Constant Summary collapse
- PRESERVED_KEYS =
%w[ SIDING_SERVER ].freeze
- RESOLUTION_KEY =
Invocation::RESOLUTION_KEY
- REVISION_KEY =
Invocation::REVISION_KEY
- BOOT_SECONDS_KEY =
Invocation::BOOT_SECONDS_KEY
- HARNESS_FRAME_PATTERN =
A backtrace line belongs to the tool itself, not the application, if it is either a frame inside this file's own directory or the
-e:frameServer::BOOTSTRAPruns as (server.rb spawns the server withruby -e, so that frame has no path of its own to match). Shared between the uncaught-exception path and the rspec path so the two cannot drift apart. /\A(?:#{Regexp.escape(__dir__)}\/|-e:)/
Instance Attribute Summary collapse
-
#boot_seconds ⇒ Object
readonly
Returns the value of attribute boot_seconds.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#project_key ⇒ Object
readonly
Returns the value of attribute project_key.
-
#revision_label ⇒ Object
readonly
Returns the value of attribute revision_label.
-
#verdict ⇒ Object
readonly
Returns the value of attribute verdict.
Instance Method Summary collapse
-
#initialize(connection:, message:, project_key:, manifest:, verdict:, boot_seconds: nil) ⇒ Worker
constructor
A new instance of Worker.
- #run ⇒ Object
Constructor Details
#initialize(connection:, message:, project_key:, manifest:, verdict:, boot_seconds: nil) ⇒ Worker
Returns a new instance of Worker.
27 28 29 30 31 32 33 34 35 |
# File 'lib/siding/worker.rb', line 27 def initialize(connection:, message:, project_key:, manifest:, verdict:, boot_seconds: nil) @connection = connection @message = @project_key = project_key @manifest = manifest @verdict = verdict @revision_label = verdict.revision_label @boot_seconds = boot_seconds end |
Instance Attribute Details
#boot_seconds ⇒ Object (readonly)
Returns the value of attribute boot_seconds.
25 26 27 |
# File 'lib/siding/worker.rb', line 25 def boot_seconds @boot_seconds end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
25 26 27 |
# File 'lib/siding/worker.rb', line 25 def connection @connection end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
25 26 27 |
# File 'lib/siding/worker.rb', line 25 def manifest @manifest end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
25 26 27 |
# File 'lib/siding/worker.rb', line 25 def @message end |
#project_key ⇒ Object (readonly)
Returns the value of attribute project_key.
25 26 27 |
# File 'lib/siding/worker.rb', line 25 def project_key @project_key end |
#revision_label ⇒ Object (readonly)
Returns the value of attribute revision_label.
25 26 27 |
# File 'lib/siding/worker.rb', line 25 def revision_label @revision_label end |
#verdict ⇒ Object (readonly)
Returns the value of attribute verdict.
25 26 27 |
# File 'lib/siding/worker.rb', line 25 def verdict @verdict end |
Instance Method Details
#run ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/siding/worker.rb', line 37 def run detach_from_server streams = Protocol.receive_streams(connection) install_streams(streams) apply_environment apply_working_directory LifeCycle.repair_after_fork refresh_application announce_state watch_the_client execute rescue Protocol::TruncatedMessage exit! 1 rescue SystemExit => e exit e.status rescue SignalException => e report_uncaught(e) die_of(e) rescue Exception => e report_uncaught(e) exit! 1 end |