# Useful methods and attributes

## Useful TaskGroup attributes

### `self.wo_metadata`

Dict containing a merge of the workorder metadatas and parameters. If there are common keys, the parameter value will be the one kept.\
\&#xNAN;*No write access is given on that object, only read access.*

### `self.analysis_metadata`

Dict containing the metadata provided at the analysis time. \
\&#xNAN;*No write access is given on that object, only read access.*

### `self.memory`

Dict containing whatever you want to store for following analysis. Be careful, there are not size limitations for now, but if you want to store something big, like an image, please talk about it with the product before doing so.\
\&#xNAN;*You have a write access on that object.*

### `self.state`

Dict containing the state of the work-order, which are the values of the tasks in that work-order from previous analysis.\
\&#xNAN;*No write access is given on that object, only read access.*

```python
self.state = {
    "task_group1": {
        "task1": ...
        "task2": ...
        "__memory" ...
    },
    "task_group2": {...}
}
```

{% hint style="info" %}
In the **`__memory`** key of a task-group is stored what was in the **`self.memory`** during the previous analysis of that task-group.\
Therefore, to pass information from a task group A to a task group B, you must first store the information in the **`self.memory`** during the analysis of task group A, then get it back during the analysis of task group B through **`self.state["A"]["__memory"]`**
{% endhint %}

### **`self.workspace`**

This is used to store whatever is needed to share between tasks during that analysis. This object won't be saved at the end of the analysis. \
\&#xNAN;*You have a write access on that object.*

{% hint style="info" %}
You could, in an equivalent way, create and use attributes to the TaskGroup class, but it is better to separate things properly and use the **`self.workspace`**
{% endhint %}

### `self._tasks`

This is where is stored the value of each executed task and associated regions during the analysis. It is the object that will be used at the end of the analysis to create the set of output task values. \
\&#xNAN;*You have a write access on that object.*

## Useful TaskGroup methods

### `self.get_task(<task_name>)`

This is the preferred way to access the value of a task that was previously executed.<br>
