Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

hopla.utils.InfoWatcher

class hopla.utils.InfoWatcher(delay_s=60)[source]

Bases: ABC

An instance of this class is shared by all jobs, and is in charge of calling scheduler to check status for all jobs at once.

Parameters:
delay_s: int, default 60

maximum delay before each non-forced call to the cluster.

__init__(delay_s=60)[source]
clear()[source]

Clears cache.

get_info(job_id)[source]

Returns a dict containing info about the job.

Parameters:
job_id: int

id of the job on the cluster.

Returns:
info: dict

information about this jobs.

get_state(job_id)[source]

Returns the state of the job.

Parameters:
job_id: str

id of the job on the cluster.

Returns:
state: str

the current state of the job.

is_done(job_id)[source]

Returns whether the job is finished.

Parameters:
job_id: str

id of the job on the cluster.

Returns:
done: bool

True if the job is done, False otherwise.

abstract read_info(string)[source]

Reads the output of the update command and returns a dictionary containing main jobs information.

register_job(job_id)[source]

Register a job on the instance for shared update.

update()[source]

Updates the info of all registered jobs.

abstract property update_command

Return the command to list jobs status.

abstract property valid_status

Return the list of valid status.