# Cylc8b1 dependent jobs not waiting for completion?

**URL:** <https://cylc.discourse.group/t/cylc8b1-dependent-jobs-not-waiting-for-completion/350>\
**Category:** Cylc Support\
**Created:** [June 14, 2021, 3:06pm UTC](https://cylc.discourse.group/t/cylc8b1-dependent-jobs-not-waiting-for-completion/350 "2021-06-14T15:06:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bencash](https://avatars.discourse-cdn.com/v4/letter/b/b2d939/32.png) [@bencash](https://cylc.discourse.group/u/bencash)\
**Post date:** [June 14, 2021, 3:06pm UTC](https://cylc.discourse.group/t/cylc8b1-dependent-jobs-not-waiting-for-completion/350/1 "2021-06-14T15:06:03Z")

</div>

I’m trying to set up a basic cycled workflow where a chain of jobs is exectuted one task after another in a chain:

`run_cesm=>run_post=>run_ml=>update_case=>run_cesm=>[repeat]`. I have tried to set this up using integer cycling to run twice, with `run_cesm` replaced by sleep 600 to create a delay. But what is happening is the workflow is just running straight through, so I end up with two copies of `run_cesm` running simultaneously. Presumably this is because I have screwed up my `flow.cylc` - if someone can tell me how to do this correctly I will be grateful. 🙂

```auto
 #!jinja2
 {% set ncycles = 2 %}
 
 [meta]
     title = "flow.cylc for MITC test run"
 
 [scheduling]
      cycling mode=integer
      initial cycle point =1
      final cycle point={{ncycles}}
      [[graph]]
          R/^/P1 = """
             run_cesm=>run_post
             run_post[-P1]=>run_ml
             run_ml[-P1]=>update_case
             update_case[-P1]=>run_cesm
             run_cesm[-P1]=>run_post
              """
 [runtime]
     [[root]]
 # platform = cheyenne
     [[run_cesm]]
         platform = cheyenne
         execution time limit = PT12H
 # script = cd /glade/work/bcash/ssf/my_cesm_sandbox/cime/scripts/MITC_base; /glade/work/bcash/ssf/my_cesm_sandbox/cime/scripts/MITC_base/cylc.case.run
         script = sleep 600
         [[[directives]]]
             -N=MITC_base.run
             -r=n
             -j=oe
             -S=/bin/bash
             -l=select=1:ncpus=36:mpiprocs=36:ompthreads=1
             -A=UMIN0005
             -m=abe
             -M=bcash@gmu.edu
             -q=regular
 
     [[run_post]]
         script = echo "run_post placeholder"
     [[run_ml]]
         script = echo "run_ml placeholder"
     [[update_case]]
         script = echo "update_case placeholder"

```

---

<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:** [June 14, 2021, 4:04pm UTC](https://cylc.discourse.group/t/cylc8b1-dependent-jobs-not-waiting-for-completion/350/2 "2021-06-14T16:04:45Z")

</div>

The inter-cycle dependencies are a little bit off, here’s a graphical representation:

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

Here’s an example which I think is closer to what you want:

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

[scheduling]
    initial cycle point = 1
    cycling mode = integer
    [[graph]]
        P1 = """
            # the repeating unit
            run_cesm => run_post => run_ml => update_case
            # the cycling rules that constrain the parallelism
            update_case[-P1] => run_cesm
        """

```

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

At the moment Cylc8 does not have the ability to generate these graphs for you (will arrive in the new Cylc GUI in the future), in the mean time I generated these graphs using the following bash script:

```bash
#!/usr/bin/env bash

set -eu

SUITE="$1"
FMT="$2"

TMP=dotfile

cylc graph --color=never --reference "$SUITE" > "$TMP.ref"

sed \
    -e 's/node "\(.*\)" "\(.*\)"/"\1" [label="\2"]/' \
    -e 's/edge "\(.*\)" "\(.*\)"/"\1" -> "\2"/' \
    -e '1i digraph {' \
    -e '$a}' \
    -e '/^graph$/d' \
    -e '/^stop$/d' \
    "$TMP.ref" \
    > "$TMP.dot"

dot \
    "$TMP.dot" \
    -T"$FMT" \
    -o "$TMP.$FMT"

rm "$TMP.ref" "$TMP.dot"

echo "written to $TMP.$FMT"

```

---

<div class="post-metadata">

**Author:** ![bencash](https://avatars.discourse-cdn.com/v4/letter/b/b2d939/32.png) [@bencash](https://cylc.discourse.group/u/bencash)\
**Post date:** [June 14, 2021, 6:34pm UTC](https://cylc.discourse.group/t/cylc8b1-dependent-jobs-not-waiting-for-completion/350/3 "2021-06-14T18:34:10Z")

</div>

That did it, thanks!
