inginious.client package¶
Submodules¶
inginious.client.client module¶
-
class
inginious.client.client.
AbstractClient
[source]¶ Bases:
object
-
get_job_queue_info
(jobid)[source]¶ Parameters: jobid – the jobid of a task. Returns: If the submission is in the queue, then returns a tuple (nb tasks before running (or -1 if running), approx wait time in seconds) Else, returns None
-
get_job_queue_snapshot
()[source]¶ - Get a snapshot of the remote backend job queue. May be a cached version.
- May not contain recent jobs. May return None if no snapshot is available
Return a tuple of two lists (or None, None): jobs_running: a list of tuples in the form
(job_id, is_current_client_job, info, launcher, started_at, max_end) where - job_id is a job id. It may be from another client. - is_current_client_job is a boolean indicating if the client that asked the request has started the job - agent_name is the agent name - info is “courseid/taskid” - launcher is the name of the launcher, which may be anything - started_at the time (in seconds since UNIX epoch) at which the job started - max_end the time at which the job will timeout (in seconds since UNIX epoch), or -1 if no timeout is set- jobs_waiting: a list of tuples in the form
- (job_id, is_current_client_job, info, launcher, max_time) where - job_id is a job id. It may be from another client. - is_current_client_job is a boolean indicating if the client that asked the request has started the job - info is “courseid/taskid” - launcher is the name of the launcher, which may be anything - max_time the maximum time that can be used, or -1 if no timeout is set
-
new_job
(task, inputdata, callback, launcher_name='Unknown', debug=False, ssh_callback=None)[source]¶ Add a new job. Every callback will be called once and only once.
Parameters: - inputdata (Storage or dict) – input from the student
- callback (__builtin__.function or __builtin__.instancemethod) – a function that will be called asynchronously in the client’s process, with the results. it’s signature must be (result, grade, problems, tests, custom, archive), where: result is itself a tuple containing the result string and the main feedback (i.e. (‘success’, ‘You succeeded’); grade is a number between 0 and 100 indicating the grade of the users; problems is a dict of tuple, in the form {‘problemid’: result}; test is a dict of tests made in the container custom is a dict containing random things set in the container archive is either None or a bytes containing a tgz archive of files from the job
- launcher_name (str) – for informational use
- debug (bool or string) – Either True(outputs more info), False(default), or “ssh” (starts a remote ssh server. ssh_callback needs to be defined)
- ssh_callback (__builtin__.function or __builtin__.instancemethod or None) – a callback function that will be called with (host, port, password), the needed credentials to connect to the remote ssh server. May be called with host, port, password being None, meaning no session was open.
Returns: the new job id
-
-
class
inginious.client.client.
Client
(context, backend_addr, queue_update=10)[source]¶ Bases:
inginious.client._zeromq_client.BetterParanoidPirateClient
-
new_job
(task, inputdata, callback, launcher_name='Unknown', debug=False, ssh_callback=None)[source]¶ Add a new job. Every callback will be called once and only once.
Parameters: - inputdata (Storage or dict) – input from the student
- callback (__builtin__.function or __builtin__.instancemethod) – a function that will be called asynchronously in the client’s process, with the results. it’s signature must be (result, grade, problems, tests, custom, archive), where: result is itself a tuple containing the result string and the main feedback (i.e. (‘success’, ‘You succeeded’); grade is a number between 0 and 100 indicating the grade of the users; problems is a dict of tuple, in the form {‘problemid’: result}; test is a dict of tests made in the container custom is a dict containing random things set in the container archive is either None or a bytes containing a tgz archive of files from the job
- launcher_name (str) – for informational use
- debug (bool or string) – Either True(outputs more info), False(default), or “ssh” (starts a remote ssh server. ssh_callback needs to be defined)
- ssh_callback (__builtin__.function or __builtin__.instancemethod or None) – a callback function that will be called with (host, port, password), the needed credentials to connect to the remote ssh server. May be called with host, port, password being None, meaning no session was open.
Returns: the new job id
-
inginious.client.client_buffer module¶
Contains ClientBuffer, which creates a buffer for a Client
-
class
inginious.client.client_buffer.
ClientBuffer
(client)[source]¶ Bases:
object
A buffer for a Client
-
get_result
(bjobid)[source]¶ Get the result of task. Must only be called ONCE, AFTER the task is done (after a successfull call to is_done). :return a tuple (result, grade, problems, tests, custom, archive) result is itself a tuple containing the result string and the main feedback (i.e. (‘success’, ‘You succeeded’) grade is a number between 0 and 100 indicating the grade of the users problems is a dict of tuple, in the form {‘problemid’: result} test is a dict of tests made in the container custom is a dict containing random things set in the container archive is either None or a bytes containing a tgz archive of files from the job
-