# Export a TASK\_CYCLE\_POINT dependent value to all tasks

**URL:** <https://cylc.discourse.group/t/export-a-task-cycle-point-dependent-value-to-all-tasks/781>\
**Category:** Cylc Support\
**Created:** [October 12, 2023, 3:41pm UTC](https://cylc.discourse.group/t/export-a-task-cycle-point-dependent-value-to-all-tasks/781 "2023-10-12T15:41:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![prajeeshag](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/prajeeshag/32/212_2.png) [@prajeeshag](https://cylc.discourse.group/u/prajeeshag)\
**Post date:** [October 12, 2023, 3:41pm UTC](https://cylc.discourse.group/t/export-a-task-cycle-point-dependent-value-to-all-tasks/781/1 "2023-10-12T15:41:33Z")

</div>

Hi,

I need to get the following values in multiple tasks  
NEXT\_CYCLE\_POINT=$($ISODATETIME ${CYLC\_TASK\_CYCLE\_POINT} --offset1=P1M)  
RUN\_DURATION\_HOURS=$($ISODATETIME ${CYLC\_TASK\_CYCLE\_POINT} ${NEXT\_CYCLE\_POINT} --as-total H)  
Is there a way to make these calculations just once and make them available to all the tasks within a CYCLE\_POINT?

Thanks,

---

<div class="post-metadata">

**Author:** ![oliver.sanders](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/oliver.sanders/32/110_2.png) [@oliver.sanders](https://cylc.discourse.group/u/oliver.sanders)\
**Post date:** [October 12, 2023, 4:01pm UTC](https://cylc.discourse.group/t/export-a-task-cycle-point-dependent-value-to-all-tasks/781/2 "2023-10-12T16:01:20Z")

</div>

> Is there a way to make these calculations just once

No.

> make them available to all the tasks within a CYCLE\_POINT?

Yes.

* * *

This will make these environment variables available to all tasks, but it won’t save on the compute cost of running the `isodatetime` command:

```auto
[runtime]
    [[root]]
        [[[environment]]]
            NEXT_CYCLE_POINT=$($ISODATETIME ${CYLC_TASK_CYCLE_POINT} --offset1=P1M)
            RUN_DURATION_HOURS=$($ISODATETIME ${CYLC_TASK_CYCLE_POINT} ${NEXT_CYCLE_POINT} --as-total H)

```

That said, `isodatetime` should be reasonably quick.

---

<div class="post-metadata">

**Author:** ![prajeeshag](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/prajeeshag/32/212_2.png) [@prajeeshag](https://cylc.discourse.group/u/prajeeshag)\
**Post date:** [October 12, 2023, 4:17pm UTC](https://cylc.discourse.group/t/export-a-task-cycle-point-dependent-value-to-all-tasks/781/3 "2023-10-12T16:17:51Z")

</div>

Thanks, that will do.

---

<div class="post-metadata">

**Author:** ![hilary.j.oliver](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/hilary.j.oliver/32/4_2.png) [@hilary.j.oliver](https://cylc.discourse.group/u/hilary.j.oliver)\
**Post date:** [October 13, 2023, 4:58am UTC](https://cylc.discourse.group/t/export-a-task-cycle-point-dependent-value-to-all-tasks/781/4 "2023-10-13T04:58:37Z")

</div>

> [@prajeeshag](#):
>
> Is there a way to make these calculations just once and make them available to all the tasks within a CYCLE\_POINT?

Actually there is. The first task in the cycle point could compute the values, then use `cylc broadcast` to set them in the environment of all upcoming tasks in the same cycle point.

However, I’d just use @oliver.sanders 's solution (which amounts to having every task compute the same values, but it’s easy).

---

<div class="post-metadata">

**Author:** ![oliver.sanders](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/oliver.sanders/32/110_2.png) [@oliver.sanders](https://cylc.discourse.group/u/oliver.sanders)\
**Post date:** [October 13, 2023, 8:30am UTC](https://cylc.discourse.group/t/export-a-task-cycle-point-dependent-value-to-all-tasks/781/5 "2023-10-13T08:30:57Z")

</div>

Good point about broadcast!
