Module: Patriot::Worker
- Defined in:
- lib/patriot/worker.rb,
lib/patriot/worker/base.rb,
lib/patriot/worker/servlet.rb,
lib/patriot/worker/info_server.rb,
lib/patriot/worker/job_store_server.rb,
lib/patriot/worker/multi_node_worker.rb,
lib/patriot/worker/servlet/index_servlet.rb,
lib/patriot/worker/servlet/job_api_servlet.rb,
lib/patriot/worker/servlet/api_servlet_base.rb,
lib/patriot/worker/servlet/worker_api_servlet.rb
Overview
namespace for workers
Defined Under Namespace
Modules: Servlet, Status Classes: Base, InfoServer, JobStoreServer, MultiNodeWorker
Constant Summary collapse
- JOB_ID_IN_EXECUTION =
name of thread local variable for job_id executed by the thread
:JOB_ID_IN_EXECUTION
- SIGNAL_FOR_GRACEFUL_SHUTDOWN =
SIGNAL used for graceful shutdown
['INT', 'TERM']
- SIGNAL_FOR_THREAD_DUMP =
SIGNAL used for getting thread dump
['QUIT']
- DEFAULT_FETCH_CYCLE =
default fetch cycle for getting job tickets in minutes
300
- DEFAULT_FETCH_LIMIT =
default limit of the number of jobs fetched at once
200
- DEFAULT_WORKER_NAME =
default worker name (for logging)
'default'
Class Method Summary collapse
Class Method Details
.get_pid(config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/patriot/worker/base.rb', line 7 def get_pid(config) pid_file = get_pid_file(config) return nil unless File.exists?(pid_file) pid = nil File.open(pid_file,'r'){|f| pid = f.read.strip.to_i } begin Process.getpgid(pid) rescue Errno::ESRCH @logger.warn("process #{pid} not exist but pid file remains") if @logger return nil end return pid end |
.get_pid_file(config) ⇒ Object
22 23 24 25 |
# File 'lib/patriot/worker/base.rb', line 22 def get_pid_file(config) worker_name = config.get('worker_name', Patriot::Worker::DEFAULT_WORKER_NAME) return File.join($home, 'run', "patriot-worker_#{worker_name}.pid") end |