class Beetle::Exec
- Beetle::Exec
- Reference
- Object
Overview
Instances of this class are not created directly but rather by the Server
object from the JSON payload associated
with the /exec
request.
The fields in the JSON payload are:
name
- Corresponds to thename
field of theJob
you wish to execute.params
- An optional collection of key-value pairs to define run-time parameters to be made accesible to theTask
objects that are executed as part of this job.max_failure_count
- Abort a Job Execution if I've seen this many errors (0 = no limit).report_progress
- Should the beetle server report on progress of this job every 10 seconds? (defaulttrue
)report_failures
- Should the beetle server report on task failures? (defaulttrue
)error_400_on_threshold_exceeded
- The server will respond with a response code of 400 if any threshold is exceeded. Defaults tofalse
.webhook_url
- The URL to receive the output of the Job Execution. If this is set the job execution will be enqueued and run anynchronously. The/exec
request will respond immediately withExecution request enqueued
. After the async job has been executed, the response will be delivered to the webhook URL.
The server listening on webhook_url
should accept the JSON encoded JobExec
payload as a POST
request.
If webhook_url
is populated the error_400_on_threshold_exceeded
value is ignored.
For example (payload for a /exec
request):
{
"name": "charges_local",
"params": {
"sc_mc": "mc"
}
}
Here's an example of accessing the run-time parameters:
abstract class BCaaSTask < Beetle::Task
def sc_mc
ret = "mc"
if p = @params
if v = p["sc_mc"]?
v = v.downcase
v = "sc" unless v == "mc"
ret = v
end
end
ret
end
end
Included Modules
- JSON::Serializable