# External triggers not working with workflow\_state function

**URL:** <https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143>\
**Category:** Cylc Support\
**Created:** [March 17, 2025, 8:14pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143 "2025-03-17T20:14:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![alice](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@alice](https://cylc.discourse.group/u/alice)\
**Post date:** [March 17, 2025, 8:14pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/1 "2025-03-17T20:14:07Z")

</div>

Using the exact example found here

> **[External Triggers — Cylc 8.4.1 documentation](https://cylc.github.io/cylc-doc/stable/html/user-guide/writing-workflows/external-triggers.html)**

With the “upstream” workflow being:

```ini
[scheduler]
    cycle point format = %Y
[scheduling]
    initial cycle point = 2005
    final cycle point = 2015
   [[graph]]
      P1Y = "foo => bar"
[runtime]
   [[bar]]
      script = sleep 10
   [[foo]]
      script = sleep 5; cylc message "data ready"
      [[[outputs]]]
          x = "data ready"

```

And the “downstream” workflow being:

```ini
[scheduler]
    cycle point format = %Y
[scheduling]
    initial cycle point = 2010
    [[xtriggers]]
        upstream = workflow_state("up//%(point)s/foo:x"):PT10S
        clock_0 = wall_clock(offset=PT0H)
   [[graph]]
        P1Y = """
            foo
            @clock_0 & @upstream => FAM:succeed-all => blam
        """
[runtime]
    [[root]]
        script = sleep 5
    [[foo, blam]]
    [[FAM]]
    [[f1,f2,f3]]
        inherit = FAM

```

Tasks in the downstream workflow never seem to trigger despite the upstream workflow’s foo jobs finishing. Is this functionality just simply broken in the current version of Cylc 8? I haven’t been able to figure out what if anything i’m doing wrong.

---

<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:** [March 17, 2025, 10:36pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/2 "2025-03-17T22:36:27Z")

</div>

Hi @alice

The `workflow_state` xtrigger works fine, but it seems we forgot to update the documented example with a recent change to the function arguments - sorry!

```diff
$ diff flow.cylc flow.cylc.orig
6c6
< upstream = workflow_state("up//%(point)s/foo:x", is_trigger=True):PT10S
---
> upstream = workflow_state("up//%(point)s/foo:x"):PT10S

```

(The `is_trigger` flag is (now) required to avoid a possible ambiguity between task statuses and task messages. The documentation you’ve linked to mentions the argument but doesn’t use it in the example).

Note also that the name `up` should be replaced with whatever name you’ve used to run the upstream workflow.

---

<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:** [March 17, 2025, 10:58pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/3 "2025-03-17T22:58:43Z")

</div>

(I’ve posted a correction to the cylc-doc repository).

---

<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:** [March 17, 2025, 11:58pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/4 "2025-03-17T23:58:45Z")

</div>

P.s. without the `is_trigger` argument, the “downstream” example actually fails validation with a reasonably informative error message:

```auto
$ cylc val .
XtriggerConfigError: [@upstream] workflow_state(up//%(point)s/foo:x)
No such task state "x"

```

… and it won’t run, for the same reason - so I’m not sure how you were able to run it?

---

<div class="post-metadata">

**Author:** ![alice](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@alice](https://cylc.discourse.group/u/alice)\
**Post date:** [March 18, 2025, 1:36pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/5 "2025-03-18T13:36:47Z")

</div>

Yeah for some reason adding the is\_trigger=True  
Argument didn’t fix the issue

---

<div class="post-metadata">

**Author:** ![MetRonnie](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/metronnie/32/125_2.png) [@MetRonnie](https://cylc.discourse.group/u/MetRonnie)\
**Post date:** [March 18, 2025, 6:32pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/6 "2025-03-18T18:32:56Z")

</div>

Can you see anything relevant in the scheduler log when you run the downstream workflow with the `--verbose` option?

---

<div class="post-metadata">

**Author:** ![alice](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@alice](https://cylc.discourse.group/u/alice)\
**Post date:** [March 18, 2025, 8:16pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/7 "2025-03-18T20:16:58Z")

</div>

Nothing relevant that i see indicating an error of any sort.

---

<div class="post-metadata">

**Author:** ![alice](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@alice](https://cylc.discourse.group/u/alice)\
**Post date:** [March 18, 2025, 8:43pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/8 "2025-03-18T20:43:07Z")

</div>

Actually it looks like i did dnd up getting an error  
TypeError: workflow\_state() got an unexpected keyword argument ‘is\_trigger’

---

<div class="post-metadata">

**Author:** ![alice](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@alice](https://cylc.discourse.group/u/alice)\
**Post date:** [March 18, 2025, 9:29pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/9 "2025-03-18T21:29:45Z")

</div>

Figured out how to make the function work. I had to explicitly set each keyword the function expects.  
workflow\_state(message=“succeeded”, point=%(point)s, task=“foo”, workflow=“up”)

---

<div class="post-metadata">

**Author:** ![alice](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@alice](https://cylc.discourse.group/u/alice)\
**Post date:** [March 18, 2025, 9:30pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/10 "2025-03-18T21:30:16Z")

</div>

Figured out how to make the function work. I had to explicitly set each keyword the function expects.

workflow\_state(message=“succeeded”, point=%(point)s, task=“foo”, workflow=“up”)

---

<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:** [March 18, 2025, 9:33pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/11 "2025-03-18T21:33:40Z")

</div>

You shouldn’t need to do that.

I suspect you’re not running the Cylc version that you think you are.

You linked to 8.4.1 documentation and mentioned “current version of Cylc 8” so I assumed 8.4.1.

But I actually ran the examples as quoted above, yesterday, and they worked fine with the additional function argument.

What does `cylc version` say?

---

<div class="post-metadata">

**Author:** ![alice](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@alice](https://cylc.discourse.group/u/alice)\
**Post date:** [March 18, 2025, 9:46pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/12 "2025-03-18T21:46:48Z")

</div>

Looks like we are using version 8.2.4

---

<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:** [March 18, 2025, 9:50pm UTC](https://cylc.discourse.group/t/external-triggers-not-working-with-workflow-state-function/1143/13 "2025-03-18T21:50:47Z")

</div>

A-ha, that would explain it!

If you can’t upgrade Cylc, note that you can choose older versions of the online documentation via the bottom of the left side-panel. Here’s a direct link to 8.2.5 docs on the `workflow_state` xtrigger:

> **[External Triggers — Cylc 8.2.5 documentation](https://cylc.github.io/cylc-doc/8.2.5/html/user-guide/writing-workflows/external-triggers.html#built-in-workflow-state-triggers)**
