andness
What is the best way to create a service user?
We have some nightly test code that will use Windmill as an API for various operations. We'd like to limit access to just the necessary API functions. For this we think we should use a group and grant the group access to the relevant folders. We're also planning to add a "service user". Since this requires a valid email address we'll either have to use a google groups address or something like developer+service@example.com.
The other options seems to be to create webhook tokens for each function that the tests will call. This gives the tightest security, but it appears that the calls will authenticate as the admin user that created the tokens?
Are there other options that we're missing?
3 replies
Get the number of filtered rows when using AgGrid
I'm trying to get the number of filtered rows when using the AgGrid. I've found that this should be available as
getAgGrid("myTable").api.getDisplayedRowCount()
, but when using this in a templated text it does not update. The problem seems to be that the text component depends on myTable.selectedRows and myTable.result (I also print the total count and the selected count in the same text. But it has no dependency that makes it re-render when the filtering changes.
Is there anything I can do to make it update on filter changes?6 replies
Catching errors
I'm trying out Windmill to run some long running nightly tests, and I'm wondering about how to deal with tests that throw.
- All the tests are run in parallell using "branch to all" with each branch set to skip on failure
- As a result the "suite" as whole thus completes even if one test explodes, good
- But at the end of the run I want to collect all the results to produce a test report
- Each test has a name, and each test should either return "success" or "failure"
- But a test that throws an exception is inconclusive
- I would like to report the failing test alongside the other tests
- But there is no way to get the name of the branch/script that caused the failure (apart from maybe parsing the stack trace which feels a little ugly)
The obvious solution is of course just to wrap the whole body of the test in a try catch and return "inconclusive" when we catch the exception, but I'm curious if there's some feature I'm missing.
I thought maybe I could create a generic failure handler script which would transform the error payload into an inconclusive result and place that after the test, but this won't work since Windmill stops running the branch on failure. Having a global failure handler also won't work since that sits outside of the flow and can't affect the final result.
What I think would work well is an exception handler tied to the script, sort of like a try/catch as a workflow node.
12 replies
Can't get a simple button working
Feeling pretty dumb here... I'm trying out the App Editor, and I've made a button which receives some data and calls a Python script which prints the data... and that's all! And when I click this button it calls the Python script, but then it never comes out of the "Loading" state. I've tried returning True from the Python script, I've tried attaching a Transformer to do
myButton.loading=false
.... I just can't figure it out. There must be something very basic I'm doing wrong 😳14 replies
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
, then the shared connectivity code would check if the override resource is set, and if the workflow_id stored in it is 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
and 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?5 replies
How can I use a context variable in a branch predicate?
I'm trying to use a context variable in a branch predicate, but I can't figure out the right syntax. The documentation on flow inputs has some examples (see picture), but none of them work.
What I'm trying to achieve is to run one part of the workflow only if an environment variable has a specific value.
Is there some documentation on what expressions are possible in the branch predicates (and flow inputs, I guess they use the same javascript evaluation?)
12 replies
What base url to use for API calls?
I'm trying to call the Windmill API from inside a script. I'm running locally on Docker for Mac. If I try to set the base url to localhost or 127.0.0.1 I just get connection refused. The only thing that seems to work is
host.docker.internal
, but when I use this the links that are rendered using BASE_INTERNAL_URL seem to broken?2 replies