WindmillWWindmill
Powered by
andnessA
Windmill•3y ago•
4 replies
andness

Get root workflow id

I have a data pipeline that normally runs in incremental mode, but sometimes we want to do a full reload. The full reload will be a workflow the reuses the normal incremental workflows with some extra config. One critical config is the target database. During the full reload we'll target a temporary database, and at the end of the flow we'll exchange tables between the old and new. This gives us a very safe mechanism for doing reloads non-destructively.

One way to achieve this would be to parameterize all the incremental loading scripts (and workflows). But this would complicate the code for something that happens rarely.

So, to achieve this I though instead I could set some ontextual config that should apply to all the jobs that run as a result of the top-level reload workflow to override the database they connect to. My idea was that I could set a Windmill resource which contains the necessary config as well as the workflow id of the main reload workflow.

In practice, I have some shared code for connecting to the database that would detect the presence of this override and target the temporary reload database instead. For this to work I must be able to find the "root workflow id", i.e. if I kick off the reload and it is assigned id
123
123
, then the shared connectivity code would check if the override resource is set, and if the workflow_id stored in it is
123
123
it would apply the override config. This way the normal pipelines can continue running unaffected.

But it appears that there is no variable that contains this, just
WM_FLOW_PATH
WM_FLOW_PATH
and
WM_FLOW_JOB_ID
WM_FLOW_JOB_ID
which contains info about the immediately encapsulating flow. Since we'll be dealing with nested flows here it won't work.

So, is there a way I'm not seeing for accessing the root flow id from anywhere "inside" the flow?
WindmillJoin
3,362Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

What is meant by node id in windmill workflow engine and how to get it
ashutosh7056Aashutosh7056 / help
3y ago
Adding internal root CA to server mode as well
sleshwaveSsleshwave / help
2y ago
tag "chromium" doesn't work for my workflow
Dylan ParkDDylan Park / help
16mo ago
Can the approval process be done with another workflow?
habip_okcuHhabip_okcu / help
3y ago