# How to access task resources info from task script?

**URL:** <https://cylc.discourse.group/t/how-to-access-task-resources-info-from-task-script/1338>\
**Category:** Cylc Support\
**Created:** [August 25, 2026, 3:41pm UTC](https://cylc.discourse.group/t/how-to-access-task-resources-info-from-task-script/1338 "2026-08-25T15:41:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpabla50](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@bpabla50](https://cylc.discourse.group/u/bpabla50)\
**Post date:** [August 25, 2026, 3:41pm UTC](https://cylc.discourse.group/t/how-to-access-task-resources-info-from-task-script/1338/1 "2026-08-25T15:41:02Z")

</div>

Is there any built in tool or environment variable(s) , which can provide in the tasks resources info such as a) hostname it is running b) queue name, wallclock, memory etc d) topology used by mpi program  
For example, from another sequencer, nodeinfo tool provides:

```auto
node.wallclock=120 ..wall clock in minutes
node.cpu=37x46x2 ...topology, 37*46 ...number of MPI tiles, 2 is openmp threads
node.machine=cluster_name
node.queue=development

I need to know these info inside task script....

```

-also looking for a small example to run mpi program [flow.cylc, fortran code using openmp/mpi) with cylc.

---

<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:** [August 25, 2026, 3:51pm UTC](https://cylc.discourse.group/t/how-to-access-task-resources-info-from-task-script/1338/2 "2026-08-25T15:51:33Z")

</div>

> a) hostname it is running

`$HOSTNAME`

  

> b) queue name, wallclock, memory etc

This information isn’t necessarily available to Cylc (which only knows the directives used to submit the job), however, your batch system (e.g, pbs, slurm, etc) may provide access to this information.

Note, the directives Cylc was configured to use are written to the top of the `job` file for inspection.

  

> d) topology used by mpi program

Not that I’m aware of?

  

> also looking for a small example to run mpi program [flow.cylc, fortran code using openmp/mpi) with cylc.

Cylc is just automating the writing and tracking of your job scripts. However you would run the MPI job with your batch system normally, provide those scripts, directives and environment variables to Cylc and it will work the same.

  

Cheers,  
O

---

<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:** [August 25, 2026, 8:00pm UTC](https://cylc.discourse.group/t/how-to-access-task-resources-info-from-task-script/1338/3 "2026-08-25T20:00:42Z")

</div>

> [@bpabla50](#):
>
> For example, from another sequencer, nodeinfo tool provides:

According to Google:

> The `nodeinfo` command on high-performance computing (HPC) clusters running Slurm is a custom convenience script or alias built around the native `sinfo`

So it just queries the batch system (Slurm) as @oliver.sanders suggested.

If you have `nodeinfo` (or `sinfo`) on your system, you can use it just the same in Cylc task scripting.

---

<div class="post-metadata">

**Author:** ![TomC](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/tomc/32/115_2.png) [@TomC](https://cylc.discourse.group/u/TomC)\
**Post date:** [August 26, 2026, 9:15pm UTC](https://cylc.discourse.group/t/how-to-access-task-resources-info-from-task-script/1338/4 "2026-08-26T21:15:28Z")

</div>

You could also store the details as environment variables yourself in the task definition. There was similar discussion in this thread [Cylc 8.6.2 how to grab execution time limit as variable](https://cylc.discourse.group/t/cylc-8-6-2-how-to-grab-execution-time-limit-as-variable/1294)
