Task

Kiss ATS Task

class kissats.task.BaseTask(task_in=None, global_params_in=None, schema_add=None)

Bases: object

Base task class

Parameters:
  • task_in (Any) – an object containing the appropriate functions
  • global_params_in (dict) – Global dictionary of parameters used to configure the environment. This dictionary will also be passed to the registered task functions.
  • schema_add (dict) – additional schema definition to be applied to task params
ats_client

ATS client class based on BaseATSClient

check_ats_valid()

check if task is valid for the ATS

check_dut_valid()

check if task is valid for the DUT

check_requires()

Verify all requirements for executing the task are met

Returns:True if all requirements are met
Return type:bool
check_resources_ready()

check if all resources are reserved for the task

Returns:True if all resources are ready
Return type:bool
claim_resources()

Claim all reservations

global_params

Global Parameters to be passed to the task

missing_keys

Missing parameter dictionary keys

name

The name of the task. This will be the name tracked and reported by the TaskPack

params

Run parameters of the task.

see Task Parameters.

release_resources()

Release all reservations and clear time window

reserve_resources()

Request reservations for all resources

Returns:True if all resources were reserved
Return type:bool
resource_delay()

delay all resource reservations

Returns:True if all resources are reserved
Return type:bool
resource_list

List of resources needed for task

run_task()

run the task

If the task module has a task_setup, task_setup will be executed first.

If the task module has a task_teardown, task_teardown will be executed after the task_main function. If the task params key always_teardown is set to True, task_teardown will run regardless of the exit status of task_setup and the run function.

Warning

If the property always_teardown is True, task_teardown will execute even if task_setup or run raise an exception.

set_time_window(start_time, end_time)

set the expected execution time of the task for reservation planning

Parameters:
  • start_time (float) – Epoch time of expected start Default: time.time() of function call
  • end_time (float) – Epoch time of expected completion. Default: start_time + time_estimate
task_main()

The main task

task_prereqs

prereqs for the task

task_setup()

Setup action for this task.

task_teardown()

Teardown action for this task

time_estimate

estimated total run time

time_window

Planned execution time

class kissats.task.Task(task_in=None, global_params_in=None, schema_add=None)

Bases: kissats.task.BaseTask

a task and it’s parameters

Parameters:
  • task_in (Any) –

    The importable name of the task to run or a module containing the appropriate functions

    Note

    If a str, should be in package.module format

  • global_params_in (dict) – Global dictionary of parameters used to configure the environment. This dictionary will also be passed to all registered task functions.
  • schema_add (dict) – (Optional) Additional Cerberus schema definition to be applied to the init_params
ats_client

Instantiated ATS client class based on BaseATSClient

check_ats_valid()

check if task is valid for the ATS

If ATS is not specified in global params this method will return True

check_dut_valid()

check if task is valid for the DUT

If DUT is not specified in global params this method will return True

check_requires()

Verify all requirements for executing the task are met

Returns:

True if all requirements are met

Return type:

bool

Raises:
  • MissingTestParamKey
  • InvalidDut
  • InvalidATS
  • ResourceNotReady
check_resources_ready()

check if all resources are reserved for the task

Returns:
True if an ATS Client is registered and
all resources are reserved, will also return True if an ATS Client is not registered
Return type:bool
claim_resources()

Claim all reservations

get_params()

The parameters for executing the task

global_params

Global Parameters to be passed to the task

missing_keys

Missing parameter dictionary keys

name

The name of the task.

This will be the name tracked and reported by the TaskPack

params

Run parameters of the task.

This will call get_params on the task module registered, expecting a dict conforming with the Task Parameters.

release_resources()

Release all reservations and clear time window

reserve_resources()

Request reservations for all resources

Returns:True if all resources were reserved
Return type:bool
resource_delay()

Delay all resource reservations

Warning

this method will reset the time_window

Returns:True if all resources are reserved
Return type:bool
resource_list

List of resources needed for task

run_task()

run the task

If the task module has a task_setup, task_setup will be executed first.

If the task module has a task_teardown, task_teardown will be executed after the run function. If the task params key always_teardown is set to True, task_teardown will run regardless of the exit status of task_setup and the run function.

Warning

If the class property always_teardown is True, task_teardown will execute even if task_setup or task_main raise an exception.

set_time_window(start_time=None, end_time=None)

set the expected execution time of the task for reservation planning

Parameters:
  • start_time (float) – Epoch time of expected start Default: time.time() of function call
  • end_time (float) – Epoch time of expected completion. Default: start_time + time_estimate
task_main()

The main task function

task_mod

Any class, module or duck

Must contain the minimum task execution attributes run and get_params.

Alternately accepts a string and will import the module.

Note

If a string is used, it should be in importable package.module format.

task_prereqs

prereqs for the task

task_setup()

Setup action for this task.

task_teardown()

Teardown action for this task

time_estimate

estimated total run time

time_window

Planned execution time