HI, another question around argo event and trigger...
# ask-metaflow
f
HI, another question around argo event and triggering a flow with
project
decorator. We have something like as below. When we publish the
data_event
it seems to trigger all the variant of the
CustomFlow
not just the
production
one. We have deployed flow with
--production
option and then there are some other variants. We only want to trigger the
production
one. Is this possible to achieve?
Copy code
@trigger(event="data_split")
@project(name="data")
class CustomFlow(FlowSpec):
  ....
l
Where is the
data_split
event coming from?
Is it from an upstream Metaflow flow, or some external system?
f
It's something we publish using
ArgoEvent
from outside of the flow.
l
So
ArgoEvent(name='foo').publish()
is not project/branch specific. In this case, I would recommend that on your production branch you use something like
@trigger(data.prod.data_split)
and for triggering do
ArgoEvent(name='data.prod.data_split').publish()
This way none of your other custom branches would get triggered by this external event. However, this does require you to manually manage the prefixed name of the events. Is that something that works in your case?
f
The problem is when I deploy a non prod branch it will still have the trigger set to the prod since these trigger decorators aren't dynamic but static code. So it'll still keep triggering non production branches.
l
I see. Another solution that I can think of is to have one level of indirection to make things easier. For example, I can introduce another flow called
DataSplitNotifierFlow
that has a
@trigger(event="data_split")
. You can then deploy this notifier flow only to the branches on which you want to trigger
CustomFlow
. Then you can annotate
CustomFlow
with
@trigger_on_finish(flow='DataSplitNotifierFlow')
.
@trigger_on_finish
is project/branch specific, so
DataSplitNotifierFlow
executing in prod will only trigger
CustomFlow
in prod. This way you can manage which branches of `CustomFlow`get triggered by only deploying
DataSplitNotifierFlow
to those specific branches. Is this something that can potentially be useful for you?