Module: Vx::Worker
- Extended by:
- Worker
- Included in:
- Worker
- Defined in:
- lib/vx/worker.rb,
lib/vx/worker/cli.rb,
lib/vx/worker/job.rb,
lib/vx/worker/local.rb,
lib/vx/worker/docker.rb,
lib/vx/worker/version.rb,
lib/vx/worker/configuration.rb,
lib/vx/worker/helper/config.rb,
lib/vx/worker/helper/logger.rb,
lib/vx/worker/middlewares/log_job.rb,
lib/vx/worker/middlewares/timeout.rb,
lib/vx/worker/middlewares/run_script.rb,
lib/vx/worker/consumers/jobs_consumer.rb,
lib/vx/worker/consumers/job_logs_consumer.rb,
lib/vx/worker/middlewares/start_connector.rb,
lib/vx/worker/consumers/job_status_consumer.rb,
lib/vx/worker/middlewares/update_job_status.rb
Defined Under Namespace
Modules: Helper
Classes: CLI, Configuration, Docker, Job, JobLogsConsumer, JobStatusConsumer, JobsConsumer, Local, LogJob, RunScript, StartConnector, Timeout, UpdateJobStatus
Constant Summary
collapse
- VERSION =
"0.2.1"
- @@root =
Pathname.new File.expand_path('../../..', __FILE__)
- @@config_mutex =
Mutex.new
Instance Method Summary
collapse
Instance Method Details
#config ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/vx/worker.rb', line 50
def config
@config ||= begin
@@config_mutex.synchronize do
Configuration.new
end
end
end
|
45
46
47
48
|
# File 'lib/vx/worker.rb', line 45
def configure
yield config
config
end
|
#initialize! ⇒ Object
76
77
78
79
80
|
# File 'lib/vx/worker.rb', line 76
def initialize!
root.join("lib/vx/worker/initializers").children.each do |e|
require e
end
end
|
#logger ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/vx/worker.rb', line 37
def logger
if ENV['CI_WORKER_SILENT']
config.null_logger
else
config.logger
end
end
|
62
63
64
65
66
|
# File 'lib/vx/worker.rb', line 62
def perform(job, path_prefix)
rs = run_class.new(job, path_prefix).perform
job.release
rs
end
|
#reset_config! ⇒ Object
72
73
74
|
# File 'lib/vx/worker.rb', line 72
def reset_config!
@config = nil
end
|
#root ⇒ Object
58
59
60
|
# File 'lib/vx/worker.rb', line 58
def root
@@root
end
|
#run_class ⇒ Object
68
69
70
|
# File 'lib/vx/worker.rb', line 68
def run_class
self.const_get(config.run.to_s.camelize)
end
|