Class: CloudCrowd::Server

Inherits:
Sinatra::Default
  • Object
show all
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

puts /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.

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Server

At initialization record the identity of this Ruby instance as a server.



116
117
118
119
# File 'lib/cloud_crowd/server.rb', line 116

def initialize(*args)
  super(*args)
  CloudCrowd.identity = :server
end