# How one can run the same task multiple times with same setup?

**URL:** <https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170>\
**Category:** Cylc Support\
**Created:** [May 16, 2025, 1:47pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170 "2025-05-16T13:47:53Z")\
**Posts on this page:** 20\
**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:** [May 16, 2025, 1:47pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/1 "2025-05-16T13:47:53Z")

</div>



---

<div class="post-metadata">

**Author:** ![wxtim](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/wxtim/32/151_2.png) [@wxtim](https://cylc.discourse.group/u/wxtim)\
**Post date:** [May 16, 2025, 2:39pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/2 "2025-05-16T14:39:42Z")

</div>

Bon Jour!

Without more context it’s hard to be sure if I understand what you are trying to do fully. But here goes:

## Task Parameters

[reference](https://cylc.github.io/cylc-doc/stable/html/user-guide/writing-workflows/parameterized-tasks.html#task-parameters)

This is Cylc’s built in way of dealing with parameterized tasks.

```auto
[task parameters]
    # You can explicitly list what you are doing
    run = 1..20
    colour = blue yellow

[scheduling]
    [[graph]]
        R1 = common_setup => task<colour><run> => common_end

[runtime]
    # a couple of different ways of passing the parameter into
    # whatever you are running:
    [[task<colour><run>]]
        script = my_programme --colour $CYLC_TASK_PARAM_colour
    [[environment]]
        RUN_NUMBER=$CYLC_TASK_PARAM_colour

```

### Jinja2

[reference](https://cylc.github.io/cylc-doc/stable/html/user-guide/writing-workflows/jinja2.html#jinja2)  
You can do something similar with Cylc’s Jinja2 templating.

```toml
{% for num in range(10) %}
[scheduling]
    [[graph]]
        R1 = common_setup => task_{{ num }} => common_end
[runtime]
    [[task_{{num}}]]
        script = my_programme --arg {{num}}
{% endfor %}

```

IMO the latter is harder to understand and maintain (and looks funky when parsed).

---

<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:** [May 17, 2025, 2:01am UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/3 "2025-05-17T02:01:58Z")

</div>

Like @wxtim I think we could use a bit more detail under the subject heading - it’s hard to guess exactly what you want.

But here’s another way to run _“the same task multiple times with the same setup”_ (for 10 times):

```ini
[scheduling]
    cycling mode = integer
    initial cycle point = 1
    final cycle point = 10
    [[graph]]
        P1 = same-task
[runtime]
    [[same-task]]
        # same setup

```

---

<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:** [May 20, 2025, 7:35pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/4 "2025-05-20T19:35:14Z")

</div>

Thanks to both.  
I modified my flow.cylc. A few issues a) workdir shows it ran my task only once instead of two b) out of my four tasks, only first two run, not sure, what happened to last two. In fact , I want to run only last task twice, first three only once. My flow.cylc below:

+++++

```ini
[scheduler]
  allow implicit tasks = True

[scheduling]
    cycling mode = integer
    initial cycle point = 1
    final cycle point = 2

  [[graph]]
    R1 = """
    run_prep_10km => run_mod_10km => run_prep_2p5km => run_mod_2p5km
    """
[runtime]
  [[run_prep_10km]]
    script = """
                jobid=$(sbatch $MY_DEFAULT_PATH/runjob/run_prep_10km.sh | awk '{print $4}')
                echo "Submitted job ID: $jobid"
                while squeue -j "$jobid" > /dev/null 2>&1; do
                  sleep 60
                done
                sacct -j "$jobid" --format=JobID,State
                 """
    [[[environment]]]
      MY_DEFAULT_PATH = /home/bpabla68/projects/def-yorkaqrl/bpabla68/cylc_learning/ex3
...middle two tasks are clipped from here
  [[run_mod_2p5km]]
    script = """
                jobid=$(sbatch $MY_DEFAULT_PATH/runjob/run_mod_2p5km.sh | awk '{print $4}')
                echo "Submitted job ID: $jobid"
                while squeue -j "$jobid" ; do
                  sleep 60
                done
                sacct -j "$jobid" --format=JobID,State
                 """
    [[[environment]]]
      MY_DEFAULT_PATH = /home/bpabla68/projects/def-yorkaqrl/bpabla68/cylc_learning/ex3

```

---

<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:** [May 20, 2025, 8:12pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/5 "2025-05-20T20:12:07Z")

</div>

> [@bpabla50](#):
>
> it ran my task only once instead of two

Your workflow configuration above shows you’ve used an `R1` recurrence - that means “run once”.

For integer cycling, my example above uses `P1`, not `R1`, which is short for `R/^/P1` - i.e. run repeatedly from the initial cycle point, with an integer interval of 1. Cycling syntax is explained the [scheduling section of the User Guide](https://cylc.github.io/cylc-doc/stable/html/user-guide/writing-workflows/scheduling.html).

> [@bpabla50](#):
>
> workdir shows …

I presume you mean “run directory”? Cylc has the concept of “task work directories” but they are specific to each task instance (`cycle-point/task-name`) so you won’t find evidence of multiple runs in those.

In any case, just look at the scheduler log to see exactly what happened during your run.

> [@bpabla50](#):
>
> out of my four tasks, only first two run, not sure, what happened to last two.

That presumably means your second task failed, because the third one triggers off of the success of the second. Check the scheduler log to see that, and then check the job logs of the second task to see why it failed.

A couple of other things, from looking at your `flow.cylc`:

- Your task names suggest you are running atmospheric models, for which we’d typically use datetime cycling, not integer cycling. The cycle point values can be used to set the model start points.
- You are running local background jobs that internally submit the models to Slurm and then explicitly poll for the Slurm jobs to finish. You don’t need to do that, just define a platform with Slurm as the job runner and Cylc will handle job submission and job management for you.

```ini
[runtime]
    [[run_mod_2p5km]]
        platform = my-slurm-platform # (define this in global.cylc)
        script = run_mod_2p5km.sh
        [[[directives]]]
               # (set Slurm class, job account code, resource directives, here)

```

---

<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:** [May 21, 2025, 3:34pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/6 "2025-05-21T15:34:27Z")

</div>

Thanks.

- now able to run same task multiple times. By looking at the job output in 1/ and 2/ directories of task, it looks like instance #2 ran first, and then ran instance #1. Is that normal? I thought instance #1 should run first, and then second one.
- You guessed right, eventually I have to run AQ models with CYLC, as a rookie, I am just playing with small example hellow\_world type examples. My read on documentation is yet hard i.e. struggling with syntax. What possible names/keyword goes in `[]`, `[[]]`. Are names defined left to = sign are reserved CYLC keywords or any user defined name. Can you please point me to a site, which has couple of practical flow.cylc and global.cylc examples. Any text book you recommend? Any site with CYLC 101 with practical examples.
- started working on your last point i.e. moving some of the stuff from flow.cylc to global.cylc.  
name of platform ?.

```ini
# bpabla68@cedar2 ex3]$ more global.cylc
[platforms]
 [[cedar]]
    hosts = localhost
    install target = localhost
    job runner = slurm

```

```ini
# flow.cylc:
[runtime]
  [[run_prep_10km]]
    platform = cedar
    script = """ MY_DEFAULT_PATH/runjob/run_prep_10km.sh """
    [[[environment]]]
      MY_DEFAULT_PATH = /home/bpabla68/projects/def-yorkaqrl/bpabla68/cylc_learning/ex3

```

Got : `[jobs-submit err] No matching platform "cedar" found`

---

<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:** [May 21, 2025, 11:22pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/7 "2025-05-21T23:22:57Z")

</div>

Note, when posting here you can enclose code blocks in triple single back-quotes (and inlined code in single back-quotes) to format it properly. I’ve been editing your posts to add quoting for readability.

---

<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:** [May 21, 2025, 11:43pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/8 "2025-05-21T23:43:52Z")

</div>

> [@bpabla50](#):
>
> By looking at the job output in 1/ and 2/ directories of task, it looks like instance #2 ran first, and then ran instance #1. Is that normal? I thought instance #1 should run first, and then second one

I presume you mean cycle points 1 and 2? Cylc famously handles cycling properly, unlike other workflow managers: if there is no dependence between two tasks in different cycles then (because there is no dependence between them!) they should be able to run at the same time, or even out of order.

If you don’t want them to run at the same time, that presumably means the second task depends (directly or indirectly) on the outputs of the first, in which case your dependency graph should reflect those relationships.

The following example runs tasks `a` and `b` twice (once in each cycle points, 1 and 2):

```ini
[scheduling]
    cycling mode = integer
    initial cycle point = 1
    final cycle point = 2
    [[graph]]
        P1 = """
            a
            b[-P1] => b
        """
[runtime]
    [[root]]
        script = sleep 5
    [[a]]
        # ...
    [[b]]
        # ...

```

… but `1/a` and `2/a` can both run at the same time, whereas `2/b` has to wait until `1/b` is finished.

 ![graph](https://global.discourse-cdn.com/free1/uploads/cylc1/original/1X/d9e55224c48bc3cdf917904aa39a46a572f3b06c.png)

You can run this example (try it, with `cylc vip --no-detach`) and you’ll see that `1/a, 2/a, 1/b` all submit at once, at startup, then `2/b` submits later, once `1/b` succeeds.

---

<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:** [May 22, 2025, 12:33am UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/9 "2025-05-22T00:33:09Z")

</div>

> [@bpabla50](#):
>
> My read on documentation is yet hard i.e. struggling with syntax.

Cylc has to be able to manage a wide variety of complicated cycling workflows, so the syntax has to be rich enough to express all of that. However, it’s really not difficult for everyday use cases (only the cycling syntax has a bit of a learning curve - other config items map pretty directly to core concepts).

> . Can you please point me to a site, which has couple of practical `flow.cylc` and `global.cylc`. Any text book you recommend? Any site with CYLC 101 with practical examples.

The [online documentation](https://cylc.github.io/cylc-doc/stable/html/index.html) has everything you’ve asked for. There is a tutorial section that takes you through the basics, the main User Guide, and a Reference section with exact details of what can go in workflow and global config files.

> What possible names/keyword goes in `[]`, `[[]]`. Are names defined left to = sign are reserved CYLC keywords or any user defined name.

That depends: many items are reserved keywords, but some things are (necessarily) user-defined - such as task names.

Use `cylc validate` frequently when writing or modifying your `flow.cylc` file, to catch errors.

> [@bpabla50](#):
>
> started working on your last point i.e. moving some of the stuff from flow.cylc to global.cylc

You can’t just move stuff from `flow.cylc` to `global.cylc` - the former is a workflow config file, the latter is for settings (such as platform definitions) that affect all Cylc workflows and schedulers. You can override central global config items with a user global config file, but very few global items (if any) are valid as workflow config items - they are different beasts.

> Got : `[jobs-submit err] No matching platform "cedar" found`

Did you put your global config file in one of the [valid locations](https://cylc.github.io/cylc-doc/stable/html/reference/config/global.html), where Cylc knows to find it?

---

<div class="post-metadata">

**Author:** ![wxtim](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/wxtim/32/151_2.png) [@wxtim](https://cylc.discourse.group/u/wxtim)\
**Post date:** [May 22, 2025, 8:41am UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/10 "2025-05-22T08:41:53Z")

</div>

> My read on documentation is yet hard i.e. struggling with syntax.

If I were starting again I’d really appreciate the Cylc VSCode extension - it scrapes the settings right out of the codebase so the popups tell you what each config does:

 ![Screenshot from 2025-05-22 09-39-11](https://global.discourse-cdn.com/free1/uploads/cylc1/original/1X/6951d0958afb90af238d5c8981ff15e625d57957.png)

---

<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:** [May 26, 2025, 8:32pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/11 "2025-05-26T20:32:23Z")

</div>

I want to run 3 instances of run\_mod\_10km, one after another in same cycle point i.e. when A finishes, first instance of B should start, when it finishes, it should start second instance etc. In terms of timeline, it is the same time for workflow. How can I achieve it, Following is firing 3instances of B from A at the same time, which I don’t want. Thanks for any help.

```auto
[task parameters]
  num = 1..3
[scheduling]

  [[graph]]
    R1 = """
    run_prep_10km:succeed => run_mod_10km<num>
```

---

<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:** [May 27, 2025, 12:02am UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/12 "2025-05-27T00:02:31Z")

</div>

> [@bpabla50](#):
>
> Following is firing 3instances of B from A at the same time, which I don’t want.

That’s exactly what your graph says to do. It is equivalent to this:

```ini
R1 = "A => B1 & B2 & B3"

```

If you want the instances of B in to run in sequential order, you just need to say that:

```ini

R1 = "A => B1 => B2 => B3"

```

You can also do this with task parameters, if you like:

```ini
[task parameters]
    m = 1..3
[scheduling]
    [[graph]]
        R1 = """
            A => B<m=1>
            B<m-1> => B<m> # (works for any M, for m=1..M)
        """

```

Use `cylc graph` to see if you got it right:

![g](https://global.discourse-cdn.com/free1/uploads/cylc1/original/1X/544fbafcbfbb98d6aa5a754a0417ef9866f275e4.png)

Note under `runtime` you can make these logical tasks run the same underlying apps:

```ini
[runtime]
    [[B<m>]]
         # settings

```

(They can each get their value of `m` in the job environment, if needed).

---

<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:** [May 27, 2025, 1:06pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/13 "2025-05-27T13:06:06Z")

</div>

```auto
       A => B<m=1>
            B<m-1> => B<m> # (works for any M, for m=1..M)

```

Thanks Hilary.

Your second suggestion worked. First one, `R1 = "A => B1 => B2 => B3"` worked partially. Though graph looks OK, only A ran, none of B instance started, no error in log file.

So I will implement your second approach. In my case, I have to run three instances of B in the same directory instead of three i.e. B1 produces restart file, which B2 reads, similarly B2 produces restart file, which B3 reads.

Is there way to force B’s to run in the same work directory?  
Currently it does :

```auto
ENV) [bpabla68@cedar1 1]$ pwd
/home/bpabla68/scratch/cylc-run/ex3_workflow/ex3_runname/work/1
(ENV) [bpabla68@cedar1 1]$ ls
run_mod_10km_num1 run_mod_10km_num2 run_mod_10km_num3 run_prep_10km

```

---

<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:** [May 27, 2025, 11:20pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/14 "2025-05-27T23:20:22Z")

</div>

> [@bpabla50](#):
>
> First one, `R1 = "A => B1 => B2 => B3"` worked partially. Though graph looks OK, only A ran, none of B instance started, no error in log file.

What you describe there (including “no error in log file”) is not possible!

That graph is fine, it’s very simple and Cylc will do exactly what it says.

Bear in mind that `foo => bar` is short for `foo:succeeded => bar` i.e., it means _“run `bar` if `foo` succeeds”_, and by implication do not run `bar` if `foo` fails.

If `A` ran but `B` did not, that implies either:

- `A` did not succeed, i.e. it failed
  - the scheduler log will report that `A` failed
  - the job logs for `A` will show that it failed (`job.out`, `job.err`)

- or `A` succeeded and Cylc submitted `B`, but `B`’s job submission failed
  - the scheduler log will report that `B`’s job submission failed
  - the job activity log for `B` will report that job submission failed (`job-activity.log`)

(Neither of these reflect any problem with Cylc - it’s exactly what’s supposed to happen).

> [@bpabla50](#):
>
> So I will implement your second approach.

The two approaches are identical, except that task parameters are used to generate the graph in the second case. After parameter expansion, for the same number of tasks, Cylc will see exactly the same graph - so, either your tasks failed as just described, or you made a mistake in your `flow.cylc` - did you use `cylc validate` before trying to run it?

> [@bpabla50](#):
>
> I have to run three instances of B in the same directory instead of three i.e. B1 produces restart file, which B2 reads, similarly B2 produces restart file, which B3 reads.
> 
> Is there way to force B’s to run in the same work directory?

The way we usually do this is to tell all 3 tasks to use the same shared workspace for the files they need to exchange. That’s the purpose of the [workflow share directory](https://cylc.github.io/cylc-doc/stable/html/user-guide/writing-workflows/runtime.html#workflow-share-directories) provided by Cylc. The share directory is a sub-directory of the workflow run directory. Task jobs can get this location from their runtime environment.

How you tell each task to use the shared location is down to how the underlying applications are configured. Here’s an example for two tasks, one of which takes its output location from the command line, the other from the environment:

```ini
[scheduling]
    [[graph]]
        R1 = "foo => bar"
[runtime]
    [[foo]] # write my output to "data" in the workflow share dir
        script = run_foo.sh --output=$CYLC_WORKFLOW_SHARE_DIR/data
    [[bar]] # read my input from "data" in the workflow share dir
        script = run_bar.py
        [[[environment]]]
             INPUT_FILE = $CYLC_WORKFLOW_SHARE_DIR/data

```

(Note in a cycling workflow you probably want to use cycle-specific sub-directories of the share directory).

That said, if your applications’ IO locations cannot be configured and they can only read and write from their current working directory (unlikely, but possible!) you CAN make Cylc use a common work directory for them.

From  
[Workflow Configuration — Cylc 8.4.2 documentation](https://cylc.github.io/cylc-doc/stable/html/reference/config/workflow.html#flow.cylc%5Bruntime%5D%5B%3Cnamespace%3E%5Dwork%20sub-directory)

> If several tasks need to exchange files and simply read and write from their from current working directory, setting `work sub-directory` can be used to override the default to make them all use the same workspace.

---

<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:** [May 29, 2025, 7:55pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/15 "2025-05-29T19:55:43Z")

</div>

> [@hilary.j.oliver](#):
>
> `$CYLC_WORKFLOW_SHARE_DIR`

Thanks Hilary for your help. It worked i.e. can make use of share directory to achieve my goal. Just curious, INPUT\_FILE in above example is any user defined name i.e. not CYLC reserved keyword.Are cylic reserved keywords start with CYLC string in front?  
INPUT\_FILE

---

<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:** [May 29, 2025, 8:31pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/16 "2025-05-29T20:31:25Z")

</div>

That’s right - I just meant `$INTPUT_FILE` as an environment variable that my (example/fake) application `run_bar.py` expects the user to define as the path to its inputs. (i.e. the application get its input file location from the environment, as opposed to from the command line, or from a config file, or whatever).

Any non user-defined environment variable provided to task jobs by Cylc will start with `CYLC_`. These are not reserved keywords as such, because they shouldn’t be defined in a `flow.cylc` file under any circumstances. They are provided to jobs at runtime by the scheduler.

Examples are:

- `$CYLC_WORKFLOW_SHARE_DIR` (explained above)
- `$CYLC_TASK_CYCLE_POINT` - so the job knows the cycle of the task that it represents

User Guide: [Job Script Environment Variables — Cylc 8.4.2 documentation](https://cylc.github.io/cylc-doc/stable/html/reference/job-script-vars/index.html)

---

<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:** [May 30, 2025, 5:37pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/18 "2025-05-30T17:37:32Z")

</div>

what I am doing wrong here?

```auto
 [[graph]]
    R1 = """
    run_prep_10km => run_mod_10km => run_prep_2p5km => run_mod_2p5km<num=1> ...line #1
    run_mod_2p5km<num-1> => run_mod_10km<num> ...line #2
    """
My wish list list is to run things in this order 
A => B =>C =>D1 =>D2 =>D3
cylc graph [-c -t] looks OK, but not sure it is correct flow as it is splitted into two parts.
Order of jobs submitted does not seem correct to me....
(ENV) [bpabla68@cedar1 cylc-run]$ squeue --me
          JOBID USER ACCOUNT NAME ST TIME_LEFT NODES CPUS TRES_PER_N MIN_MEM NODELIST (REASON) 
       62323129 bpabla68 def-yorkaqrl run_prep_10km R 29:56 1 32 N/A 3G cdr1661 (Prolog) 
       62323128 bpabla68 def-yorkaqrl run_mod_2p5km PD 5:00:00 16 729 N/A 3G (Priority) 

```

 ![GM_workflow](https://global.discourse-cdn.com/free1/uploads/cylc1/original/1X/daff61791f3707e5487014a09d138af2f4bb7d82.png)

---

<div class="post-metadata">

**Author:** ![wxtim](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/wxtim/32/151_2.png) [@wxtim](https://cylc.discourse.group/u/wxtim)\
**Post date:** [June 2, 2025, 7:30am UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/19 "2025-06-02T07:30:26Z")

</div>

Could be a simple typo:

```auto
 run_mod_2p5km<num-1> => run_mod_10km<num> ...line #2

```

should the `-` be an `=`?

That gives me:

 ![tmpofvjs3uf](https://global.discourse-cdn.com/free1/uploads/cylc1/original/1X/0fd4a198cf9501919ec2bc1d2d0c384ffe5db053.png)

---

<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:** [June 2, 2025, 8:20am UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/20 "2025-06-02T08:20:03Z")

</div>

> [@bpabla50](#):
>
> what I am doing wrong here?

Probably just something like what @wxtim suggests.

(It’s not clear to me exactly what you want since `A => B => C => D1 => D2 => D3` doesn’t seem to to map directly to the 2p5km and 10km tasks you have.)

If two tasks, or groups of tasks, are disconnected (e.g. like your split into two parts, which you seem not to want) then it just means you have not put a dependency (`=>`) between them.

Using task parameters make it a bit less obvious at a glance, but you can expand the parameters yourself to get the explicit version:

```auto
a<n-1> => b<n> # ... for n=1..4

```

means:

```auto
a_n1 => b_n2
a_n2 => b_n3
a_n3 => b_n4

```

---

<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:** [June 2, 2025, 1:06pm UTC](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170/21 "2025-06-02T13:06:58Z")

</div>

Thanks Tim and Hilary. Indeed it was typo on second line. My apology. I want to run one instance of run\_prep\_10km, run\_mod\_10km, run\_prep\_2p5km, and three instances of run\_mod\_2p5km due to restart file. Following seems correct order..

 ![GM_workflow](https://global.discourse-cdn.com/free1/uploads/cylc1/original/1X/2e25951241b19b764f60bda61cee1df44d7db68d.png)

[Next page](https://cylc.discourse.group/t/how-one-can-run-the-same-task-multiple-times-with-same-setup/1170.md?page=2)
