I have an argo workflow that returns some data. It’s very fast so should complete before any http request timeout.
I’d like to trigger the workflow and get the response in a single API request.
Looks like this is possible via the CLI: https://argo-workflows.readthedocs.io/en/latest/cli/argo_wait/
But I can’t seem to find a way to do this over the API.
How do I submit an argo workflow and get the response in a single API request?
Ideally in javascript using axios.
e.g. code I have to submit a workflow looks like this:
const namespace = process.env.ARGO_NAMESPACE;
const templateName = "very-fast-workflow";
const workflow = {
apiVersion: 'argoproj.io/v1alpha1',
kind: 'Workflow',
metadata: {
generateName: `${templateName}-sj-`,
},
spec: {
arguments: {
parameters: [
{
name: 'json',
value: JSON.stringify(jsonArgs),
},
],
},
workflowTemplateRef: {
name: templateName,
},
},
};
const payload = { namespace, workflow };
// this resolves once the workflow is submitted, but I want to wait until it finishes and return the results
await axiosArgo.post(`${process.env.ARGO_URL}/api/v1/workflows/${namesapce}`, payload);