Jobs
Provides basic job management functionality.
The following operations are supported. For a formal definition, please review the Service Description.
-
CancelJob
Schedules a non-quick job for cancellation. Has no effect on quick jobs.
Users may only cancel jobs they own, otherwise an exception is thrown.
This method does nothing and returns nothing if jobid is not an actual job.
Otherwise, this method returns once the status of the specified job has changed to 'Canceling' (int = 2).
Note that a job is not completely cancelled until the status of that job is 'Cancelled' (or 'Failed'); until then it still consumes a queue slot.
Transition from 'Canceling' to 'Cancelled' is an internal operation and is not controlled though web services.
This method returns nothing on success.
Parameters:
long wsid : WebServicesID of the account the cancellation will be run under.
string pw : Password of said account
long jobId : Identifier of the job to cancel
Output:
Void -
ExecuteQuickJob
Executes a synchronous query in the shortest queue of a given context.
Returns job results on job success, myriad of exceptions otherwise.
Parameters:
long wsid : WebServicesID of the account the query will be run under
string pw : Password of said account
string qry : Query to run
string context : Context of job
string taskname : Optional identifier of job
bool isSystem : System jobs are not visible in the web UI and require a flag with GetJobs().
Output:
string : A typed-csv format string containing the results of the query.
Column types are embedded in the column headers. For example,
'[ra]:Float,[dec]:Float'
describes two columns, named 'ra' and 'dec', both floating points. -
GetJobStatus
Returns an int that represents the current status of a job.
Possible values and their meanings are shown below.
0 = ready
1 = started
2 = canceling
3 = cancelled
4 = failed
5 = finished
'ready' is an idle state assigned to jobs created, but not yet processed.
'started' and 'canceling' are active states, describing jobs that are currently processing
'cancelled', 'failed' and 'finished' are final states, indicating a job's execution has terminated.
Parameters:
long wsid : WebServicesID of the account the status will be run under.
string pw : Password of said account
long jobId : Identifier of the job whose status will be retrieved.
Output:
int : A number representing the current status of the requested job. See above for what those numbers means. -
GetJobTypes
Returns an array of CJType objects that summarize, for a particular user, all available job types.
Parameters:
long wsid : WebServicesID of the account of whose types will be retrieved.
string pw : Password of said account
Output:
CJType[] : An array representing all available job types for a user.
A CJType object contains:
string Type : Name of the type
string Description : Description of this type
-
GetJobs
Returns an array of CJJob objects relevant to the conditions parameter.
GetJobs() will only return jobs created by the owner_wsid parameter,
unless owner_wsid has the 'admin' privilege, in which case all jobs are returnable.
The 'conditions' parameter is a specifically formatted string describing which jobs should be retrieved.
At the top level, this parameter is a list of keys, separated by ';'.
Each key set is described by a string key followed by ':' followed by a '|' separated list of conditions.
Each condition may have one of the following possible formats:
VALUE (equality)
VALUE, (equal or greater to VALUE)
,VALUE (less than or equal to VALUE)
V1,V2 (between V1 and V2 (inclusive))
String and DateTime values should not be quoted and may not contain any special characters (:;,|).
DateTime values can be any format that .net will parse, so long as they do not contain any of the above special characters.
The jobs returned are determined by the intersection of the keys, given the union of their conditions
Example 1:
jobid : 12345;
Jobs with a jobid equal to 12345.
Example 2:
jobid : 123|321|132;
Jobs with a jobid equal to 123 or 321 or 132.
Example 3:
jobid : 123|321; status : 5
Jobs with a status of 5 and a jobid of 123 of 321.
Example 4:
jobid : 123,|,122
Returns jobs with id greater or equal to 123 or less than or equal 122 (all of a users jobs).
Example 5:
TimeEnd : 2008-04-5,
All jobs that ended after April 5, 2008.
The following are valid keys:
long JobID : Unique identifier of job
DateTime TimeSubmit : When the job was submitted
DateTime TimeStart : When the job was started
DateTime TimeEnd : When the job completed/cancelled/failed
int Status : Current status of the job. See the GetJobStatus() description for possible Status values.
int Queue : The queue the job ran in.
string TaskName : The user submitted descriptor for the job. This can be null.
string Error : Error message for this job, if any
string Query : The query submitted for this job
string Context : The context of this job
string Type : The type of this job. See GetJobTypes for a listing of possible values.
long WSID : The WebServicesID of the owner of this job. If owner_wsid does not have the 'admin' privilege, then this has no effect.
Parameters:
long owner_wsid : ID of owner of jobs
string owner_pw : Password of said owner.
string conditions : A formatted string describing the conditions for the search. See above for details on this.
bool includeSystem : Determines whether to return system jobs
Output:
CJJob[] : An array of all jobs matching the input conditions.
A CJJob object contains:
long JobID : Unique identifier of job
long Rows : Number of rows this job modified, if applicable
WebServicesID : Identifier of user that submitted this job
DateTime TimeSubmit : When the job was submitted
DateTime TimeStart : When the job was started
DateTime TimeEnd : When the job completed/cancelled/failed
int Status : Current status of the job. See the GetJobStatus() description for possible Status values.
int Queue : The queue the job ran in.
string TaskName : The user submitted descriptor for the job. This can be null.
string OutputLoc : The URL of the output. This field is only non-null for completed jobs where OutputType != Query
string Error : Error message for this job, if any
string Query : The query submitted for this job
string Context : The context of this job
string Type : The type of this job. See GetJobTypes for a listing of possible values.
-
GetQueues
Returns an array of CJQueue objects that summarize, for a particular user, their available contexts and the respective timeouts of.
Parameters:
long wsid : WebServicesID of the account of whose contexts will be retrieved.
string pw : Password of said account
Output:
CJQueue[] : An array of CJQueue objects representing all available queues for the input user.
A CJQueue object contains:
string Context : Name of the context
int Timeout : The maximum time a job is allowed to run. The 'estimate' parameter in SubmitJob maps to the closest Timeout of a given context.
-
GetServiceState
Gets the state of the specified service component.
Account must have the admin priv.
Parameters:
long wsid : WebServicesID of admin account
string pw : Password of said account
string serviceName : Name of service that will have its state modified. See /qhealth.aspx for a listing of valid service names.
Output:
string : The state of the specified service
Possible states include:
RUNNING = Service is functioning normally.
SUSPENDING = Service will be suspended on next cycle.
SUSPENDED = Service is suspended. Continues to cycle, but no longer performs any other actions.
WAKING = Service will be RUNNING on next cycle.
-
SetServiceState
Suspends or wakes a service component.
Account must have the admin priv.
Parameters:
long wsid : WebServicesID of admin account
string pw : Password of said account
string serviceName : Name of service that will have its state modified. See /qhealth.aspx for a listing of valid service names.
string state: New state of specified service. Values may be 'SUSPENDING' or 'WAKING'
Output:
Void -
SubmitExtractJob
Submits a table extraction job.
On success, returns the jobid of the newly created job.
Parameters:
long wsid : WebServicesID of account
string pw : Password of said account
string tableName : Name of mydb table to extract.
string type : describes type of output to create. Valid types are all types returned from GetJobTypes(), excluding 'QUERY'
Output:
long : A unique identifier (jobid) of the newly created job. -
SubmitJob
Submits an asynchronous query to a queue longer than the shortest queue of a given context.
Returns a JobID on successful submission, exceptions otherwise.
Parameters:
long wsid : WebServicesID of the account the query will be run under.
string pw : Password of said account
string qry : Query to run
string context : Context of job
string taskname : Optional identifier of job.
int estimate : Job will be run in the queue with the time limit nearest to 'estimate'. Values are in minutes.
Output:
long : A unique identifier for the newly submitted job -
UploadData
Loads data into a table in mydb.
Parameters:
long wsid : WebServicesID of account
string pw : Password of said account
string tableName : Name of mydb table into which data will be loaded.
string data: ASCII encoded CSV data.
bool tableExists: If true, expects 'tableName' to exists and tries to load data into said table using the schema to determine types.
If false, creates a new table and tries to guess an appropriate schema.
Output:
Void