Get xtrigger name from task that was triggered?

Is there a way to get the xtrigger name in a task?

For example, UPSTREAM_STARTED_ECMWF and various other centres. They all trigger different tasks, and provide information as variables from the xtrigger. It would be handy to be able to just do, in a shell script

a=UPSTREAM_STARTED_ECMWF_data
data=${!a}

Rather than eiher pass in UPSTREAM_STARTED_ECMWF (or UPSTREAM_STARTED and infer ECMWF from the task name), or hardcode anything else in.

I thought it might have had something like the CYLC_TASK_NAMESPACE_HIERARCHY for xtriggers, but I couldn’t see anything in the job script.

The basic idea of asking this is because it would be useful for portability of some scripts between different workflows which have the same basic pattern, but perhaps different xtrigger names.

Can you post an issue on the cylc-flow repository for that? I think it could be useful, and easily implemented - Cylc could automatically add the xtrigger name to the dict of results returned from the function.

For now, you could modify the xtrigger function source, and get it to return its own name in the results dict.

(I presume you mean the actual function name, not the short trigger name used in the graph?)