informaticainformatica-powercenter

Using a Command Task to create a shell to run the same workflow again in a loop using nohup


I know that the typical solution to have a recursive workflow call is to create 2 workflows and call each other until a condition is met and the workflow is ended.

But I tried to do this without a second workflow, instead I used a command at the last of flow in the workflow and with it I create a shell script which then I run using nohup and &.

It apparently works, but the pmcmd command return with a weird message, supposedly my workflow that just ran few seconds before is impacted, which clearly is not, as it just ran.

Let's say my workflow name is: wkf_myworkflow_looped

I create the shell like this each is a line in Command task:

echo '#!/bin/sh'>/batch/myproject/run_next.sh

echo 'sleep 60' >>/batch/myproject/run_next.sh

echo 'pmcmd startworkflow -service $$SERVICE -domain $$DOMAIN -u $$USER -p $$PASSWORD -f $$FOLDER -nowait wkf_myworkflow_looped'>>/batch/myproject/run_next.sh

chmod 777 /batch/myproject/run_next.sh

nohup /batch/myproject/run_next.sh>>/batch/myproject/run_next_out.txt t 2>&1 &

Then, the workflow finish and I wait 60 seconds. I gave this delay to allow the workflow to totally settle and be rested in succeeded state.

But, when I open the output file run_next_out.txt it says:

Informatica(r) PMCMD, version [10.5.1], build [614.0914], LINUX 64-bit

Copyright (c) 1993-2021 Informatica LLC. All Rights Reserved.

See patents at https://www.informatica.com/legal/patents.html.

 

Invoked at Sat Aug 03 19:07:57 2024

 

Connected to Integration Service: [INT_SERVICE].

Starting workflow [wkf_myworkflow_looped]

ERROR: Workflow Workflow [MYFOLDER:wkf_myworkflow_looped[version 14]] is impacted. 

The Integration Service is not configured to run sessions impacted by dependency updates. Please check the Integration Service log for more information.

Disconnecting from Integration Service

 

Completed at Sat Aug 03 19:07:57 2024

But my workflow is not impacted, I checked it and I just ran it. It just ran a minute before.

Why is this happening?

It looks like pmcmd don't like to be called from a process that is running the main PC process.

Does anybody have tried this with success?


Solution

  • SUGGESTED SOLUTION

    A TYPICAL solution to have a recursive workflow is to create one, continuously running workflow:

    Run Continuously. The Integration Service runs the workflow as soon as the service initializes. The Integration Service then starts the next run of the workflow as soon as it finishes the previous run.

    Inside the workflow there can be a condition determining the actions to take or wait, etc.

    Quite common solution is to have a logic to check if indicator file exists. Wait task check if an indicator file exists and conrinues to run the workflow. If workflow should stop, a task is executed to remove the indicator file - the workflow will keep waiting until some external process creates the file again and it will get started again.

    POSSIBLE ROOT CAUSE

    The "sessions impacted by dependency updates" suggests that there are changes not properly fetched over to the session. Refresh all the sessions and mappings,, make sure everything is saved and checked-in (in case of versioned repo).

    Next: keep in mind that most likely it is not YOU who executes the workflow for the second time. Integration Service has an OS profile defined and there's the user running the script. And might not see all the changes if not everything is checked in. So while you invoke the workflow, the script is executed in context of a different user. Things may go sideways here. Make sure the appropriate rights are also in place.

    The idea mentioned above comes from this post I've found thinking about the issue.

    While this should help you solve it, the typical way to tackle it would be still running the workflow continuously, as mentioned above :)