# prism.task.PrismTask

## Constructor

<details>

<summary><code>prism.task.PrismTask</code></summary>

*`class`*` ``prism.task.PrismTask(`*`bool_run: bool = True, func: Optional[Callable[..., Any]] = None`*`)`

* **Parameters**
  * `bool_run`: a boolean indicating whether to run the task. Default is `True`.
  * `func`: optional callable that overwrites the `run` function. Default is `None`.

</details>

{% hint style="warning" %}
**Warning**: you will *never* need to worry about instantiating a `PrismTask` class and setting `bool_run` / `func` when working with your tasks. This is all handled on the backend.
{% endhint %}

## Attributes and underlying data

<details>

<summary><code>PrismTask.RETRIES</code></summary>

Number of times to retry a task upon failure. Default is 0.

```python
# tasks/example_task.py

import prism.task

class ExampleTask(prism.task.PrismTask):
    
    RETRIES = 1
    
    def run(self, tasks, hooks):
        test_str = "Hello, world!"
        return test_str
```

</details>

<details>

<summary><code>PrismTask.RETRY_DELAY_SECONDS</code></summary>

Number of seconds to wait in between task retries. Default is 0. Must be specified alongside [`RETRIES`](#prismtask.retries).

```python
# tasks/example_task.py

import prism.task

class ExampleTask(prism.task.PrismTask):
    
    RETRIES = 1
    RETRY_DELAY_SECONDS = 60
    
    def run(self, tasks, hooks):
        test_str = "Hello, world!"
        return test_str
```

</details>
