Skip to main content
Answer

Workflows use case: Run a function post successful run of previous function

  • October 17, 2023
  • 2 replies
  • 41 views

Akash Sood
MVP
Forum|alt.badge.img+3

@Jørgen Lund

We have a use case for Workflow Orchestration feature in a project – an example being we would like to run some workflows (Cognite functions) after successful runs of certain workflows as they have a dependency between them.

There are some conversion and allocation factors that vary periodically and will be updated to SharePoint via end users. Based on the dates for these numbers, we will utilize them for further data munging and calculations in other Cognite functions, given that the previous function run was successful.

Can we use workflows for this? If yes, can we enable this in our project?

Best answer by Jørgen Lund

Hi @Akash Sood, thank you for the question.

Workflow Orchestration allows you to define the dependencies between Cognite Functions and have them executed accordingly.

If a Cognite Funciton “B” depends on the successful completion of Cognite Function “A”, you could define a workflow “A” → “B”, which when executed would first trigger “A”, and on its successful completion, trigger “B”. If “A” fails, the workflow will fail, and “B” will not be triggered. The workflow definition is quite flexible, so more complex dependencies between steps are possible (e.g. in cases where you want to execute a set of Functions, wait for all to complete, before executing another set of Functions).

It sounds like you would be able to leverage Workflows to solve your use case, and I encourage you to try it out. @Aditya Kotiyal can help you get set up. Note that the service is currently in Beta and should not yet be relied upon in a production setting. 

Let me know if there are additional nuances to your use case, or if you have other questions!

2 replies

Jørgen Lund
Seasoned Practitioner
Forum|alt.badge.img
  • Product Manager
  • Answer
  • October 18, 2023

Hi @Akash Sood, thank you for the question.

Workflow Orchestration allows you to define the dependencies between Cognite Functions and have them executed accordingly.

If a Cognite Funciton “B” depends on the successful completion of Cognite Function “A”, you could define a workflow “A” → “B”, which when executed would first trigger “A”, and on its successful completion, trigger “B”. If “A” fails, the workflow will fail, and “B” will not be triggered. The workflow definition is quite flexible, so more complex dependencies between steps are possible (e.g. in cases where you want to execute a set of Functions, wait for all to complete, before executing another set of Functions).

It sounds like you would be able to leverage Workflows to solve your use case, and I encourage you to try it out. @Aditya Kotiyal can help you get set up. Note that the service is currently in Beta and should not yet be relied upon in a production setting. 

Let me know if there are additional nuances to your use case, or if you have other questions!


Akash Sood
MVP
Forum|alt.badge.img+3
  • Author
  • MVP
  • October 23, 2023

Thanks @Jørgen Lund. I have done the needful as per your response. Will try this out.