lib/cloud-crowd.rb in documentcloud-cloud-crowd-0.2.1 vs lib/cloud-crowd.rb in documentcloud-cloud-crowd-0.2.2

- old
+ new

@@ -41,17 +41,23 @@ autoload :Server, 'cloud_crowd/server' autoload :Worker, 'cloud_crowd/worker' autoload :WorkUnit, 'cloud_crowd/models' # Keep this version in sync with the gemspec. - VERSION = '0.2.1' + VERSION = '0.2.2' # Increment the schema version when there's a backwards incompatible change. SCHEMA_VERSION = 3 # Root directory of the CloudCrowd gem. ROOT = File.expand_path(File.dirname(__FILE__) + '/..') + + # Default folder to log daemonized servers and nodes into. + LOG_PATH = 'log' + + # Default folder to contain the pids of daemonized servers and nodes. + PID_PATH = 'tmp/pids' # A Job is processing if its WorkUnits are in the queue to be handled by nodes. PROCESSING = 1 # A Job has succeeded if all of its WorkUnits have finished successfully. @@ -103,9 +109,21 @@ # Get a reference to the central server, including authentication if # configured. def central_server @central_server ||= RestClient::Resource.new(CloudCrowd.config[:central_server], CloudCrowd.client_options) + end + + # The path that daemonized servers and nodes will log to. + def log_path(log_file=nil) + @log_path ||= config[:log_path] || LOG_PATH + log_file ? File.join(@log_path, log_file) : @log_path + end + + # The path in which daemonized servers and nodes will store their pids. + def pid_path(pid_file=nil) + @pid_path ||= config[:pid_path] || PID_PATH + pid_file ? File.join(@pid_path, pid_file) : @pid_path end # The standard RestClient options for the central server talking to nodes, # as well as the other way around. There's a timeout of 5 seconds to open # a connection, and a timeout of 30 to finish reading it. \ No newline at end of file