Skip to content

ChoreTask

ChoreTask(step, process_name, parameters)

Bases: TM1Object

Abstraction of a Chore Task

A Chore task always conistst of - The step integer ID: it's order in the execution plan. 1 to n, where n is the last Process in the Chore - The name of the process to execute - The parameters for the process

Parameters:

Name Type Description Default
step int

step in the execution order of the Chores' processes. 1 to n, where n the number of processes

required
process_name str

name of the process

required
parameters List[Dict[str, str]]

list of dictionaries with 'Name' and 'Value' property: [{ 'Name': '..', 'Value': '..' }, ... ]

required
Source code in TM1py/Objects/ChoreTask.py
def __init__(self, step: int, process_name: str, parameters: List[Dict[str, str]]):
    """

    :param step: step in the execution order of the Chores' processes. 1 to n, where n the number of processes
    :param process_name: name of the process
    :param parameters: list of dictionaries with 'Name' and 'Value' property:
                        [{
                            'Name': '..',
                            'Value': '..'
                        },
                        ...
                        ]
    """
    self._step = step
    self._process_name = process_name
    self._parameters = parameters

body property

body_as_dict property

parameters property

process_name property

step property

__eq__(other)

Source code in TM1py/Objects/ChoreTask.py
def __eq__(self, other: "ChoreTask") -> bool:
    return self.process_name == other.process_name and self.parameters == other.parameters

__ne__(other)

Source code in TM1py/Objects/ChoreTask.py
def __ne__(self, other: "ChoreTask") -> bool:
    return self.process_name != other.process_name or self._parameters != other.parameters

from_dict(chore_task_as_dict, step=None) classmethod

Source code in TM1py/Objects/ChoreTask.py
@classmethod
def from_dict(cls, chore_task_as_dict: Dict, step: int = None):
    if "Process" in chore_task_as_dict:
        process_name = chore_task_as_dict["Process"]["Name"]
    else:
        # Extract "ProcessName" from "Processes('ProcessName')"
        process_name = chore_task_as_dict["Process@odata.bind"][11:-2]

    return cls(
        step=step if step is not None else int(chore_task_as_dict["Step"]),
        process_name=process_name,
        parameters=[{"Name": p["Name"], "Value": p["Value"]} for p in chore_task_as_dict["Parameters"]],
    )