# How to set environment variables in new task

**URL:** <https://forum.access-hive.org.au/t/how-to-set-environment-variables-in-new-task/700>\
**Category:** Unified Model\
**Created:** [28 April 2023 06:26 UTC](https://forum.access-hive.org.au/t/how-to-set-environment-variables-in-new-task/700 "2023-04-28T06:26:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![holger](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/holger/32/320_2.png) [@holger](https://forum.access-hive.org.au/u/holger)\
**Post date:** [28 April 2023 06:26 UTC](https://forum.access-hive.org.au/t/how-to-set-environment-variables-in-new-task/700/1 "2023-04-28T06:26:31Z")

</div>

I want to add a task to the ACCESS-CM2 job. I want to configure this task using environment variables.

I’m setting the variables in the configuration like this:

```auto
$ cat roses/u-cw525/app/update_sst/rose_app.conf
[env]
SOMEVAR=SOMETEXT

```

But when I run it, the variable is not set. I don’t find any good documentation on environment variables in rose/cylc either. Can someone tell me how to do this?

Thank you

---

<div class="post-metadata">

**Author:** ![Scott](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/scott/32/37_2.png) [@Scott](https://forum.access-hive.org.au/u/Scott)\
**Post date:** [30 April 2023 23:37 UTC](https://forum.access-hive.org.au/t/how-to-set-environment-variables-in-new-task/700/2 "2023-04-30T23:37:25Z")

</div>

Environment variables set in a rose app file are used when you use [`rose task-run`](https://metomi.github.io/rose/doc/html/api/command-reference.html#rose-task-run) to execute the task. Rose will set up the environment variables, create files, then run the command specified in the [`[command]`](https://metomi.github.io/rose/doc/html/api/configuration/application.html#rose:conf:rose-app.conf%5Bcommand%5D) section of the config file.

You’ve not specified `[command]` in your file, so I assume you’re not running with `rose task-run`?

---

<div class="post-metadata">

**Author:** ![holger](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/holger/32/320_2.png) [@holger](https://forum.access-hive.org.au/u/holger)\
**Post date:** [30 April 2023 23:43 UTC](https://forum.access-hive.org.au/t/how-to-set-environment-variables-in-new-task/700/3 "2023-04-30T23:43:01Z")

</div>

No, I’m trying to really understand rose/cylc but I don’t find more than the most cursory of documentation. The tutorials on the metoffice’s website are fine, but they don’t go into that much detail. There’s a [cylc documentation](https://cylc.github.io/cylc-doc/stable/html/index.html) but it doesn’t talk about rose at all.

---

<div class="post-metadata">

**Author:** ![Scott](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/scott/32/37_2.png) [@Scott](https://forum.access-hive.org.au/u/Scott)\
**Post date:** [30 April 2023 23:46 UTC](https://forum.access-hive.org.au/t/how-to-set-environment-variables-in-new-task/700/4 "2023-04-30T23:46:10Z")

</div>

They’re both separate projects, rose is built on top of Cylc. Try the [rose tutorial](https://metomi.github.io/rose/doc/html/tutorial/rose/index.html)

---

<div class="post-metadata">

**Author:** ![holger](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/holger/32/320_2.png) [@holger](https://forum.access-hive.org.au/u/holger)\
**Post date:** [30 April 2023 23:48 UTC](https://forum.access-hive.org.au/t/how-to-set-environment-variables-in-new-task/700/5 "2023-04-30T23:48:38Z")

</div>

Thank you, bookmarked and I’ll read through it.
