Class: CloudCrowd::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- CloudCrowd::Server
- Defined in:
- lib/cloud_crowd/server.rb
Overview
The main CloudCrowd (Sinatra) application. The actions are:
Admin
[get /] Render the admin console, with a progress meter for running jobs. [get /status] Get the combined JSON of every active job and worker. [get /worker/:name] Look up the details of a WorkUnit that a Worker is busy processing. [get /heartbeat] Returns 200 OK to let monitoring tools know the server's up.
Public API
[post /jobs] Begin a new Job. Post with a JSON representation of the job-to-be. (see examples). [get /jobs/:job_id] Check the status of a Job. Response includes output, if the Job has finished. [delete /jobs/:job_id] Clean up a Job when you're done downloading the results. Removes all intermediate files.
Internal Workers API
[put /node/:host] Registers a new Node, making it available for processing. [delete /node/:host] Removes a Node from the registry, freeing up any WorkUnits that it had checked out. [put /work/:unit_id] Mark a finished WorkUnit as completed or failed, with results.
Constant Summary collapse
- DISTRIBUTE_INTERVAL =
The interval (in seconds) at which the server will distribute new work units to the nodes
20
Instance Method Summary collapse
-
#initialize(*args) ⇒ Server
constructor
At initialization record the identity of this Ruby instance as a server.
Constructor Details
#initialize(*args) ⇒ Server
At initialization record the identity of this Ruby instance as a server.
155 156 157 158 159 160 |
# File 'lib/cloud_crowd/server.rb', line 155
def initialize(*args)
CloudCrowd.log "Starting server"
super(*args)
CloudCrowd.identity = :server
@dispatcher = Dispatcher.new(DISTRIBUTE_INTERVAL)
end
|