You are viewing limited content. For full access, please sign in.

Question

Question

Workflow - The name of the script activity under processes, what am I waiting for and how to set deadlines?

asked on May 28, 2014

Three of my workflows have all halted and say waiting. They are waiting on the activity Script which is a C# script. This script does basic calculations not available in workflow. For example find and replace in string functions. There is no looping statements, only If statements.

 

There are no processes utilizing the CPU and these are only CPU based requests.

 

What is the name of the process that it is using to execute this code would be my first question.

 

Also how do I limit the time that workflow will wait for a script so that I can have the workflow either continue or throw an error.

 

A workflow waiting on a task to complete is a nightmare. I would rather have it blow up and throw an error than go into a waiting state while running calculations. At least someone can be notified if an error occurs. If the workflow is waiting on a user that is OK, the user knows it and can be notified.

 

            //Claim Number
            String ClaimNum = GetTokenValue("PatternMatching_Claim Number").ToString();

            if (ClaimNum.Length < 4 || ClaimNum.IndexOfAny(new char[] {'0','1','2','3','4','5','6','7','8','9'}) == -1)
            {
                SetTokenValue("PatternMatching_Claim Number", "");
            }

            //Case Number
            String CaseNum = GetTokenValue("PatternMatching_Case Number").ToString();

            if (CaseNum.Length < 4 || CaseNum.IndexOfAny(new char[] {'0','1','2','3','4','5','6','7','8','9'}) == -1)
            {
                SetTokenValue("PatternMatching_Case Number", "");
            }

            //SSN
            String SSN = GetTokenValue("PatternMatching_SSN").ToString();
            SSN = Regex.Replace(SSN, "[^0-9]", "");

            if (SSN.Length == 9)
            {
                SSN = Regex.Replace(SSN, @"^(...)(..)(....)$", "$1-$2-$3");

                SetTokenValue("PatternMatching_SSN", SSN);
            }

 

0 0

Replies

replied on May 29, 2014

Try going into the WF Admin Console under Server Options, the Server Configuration node and open the Advanced Server Options dialog. In the Activity Performance tab, uncheck the box labeled "Script activities".

1 0
replied on May 29, 2014

What happens if a script is not run as a task?

0 0
replied on June 26, 2019

Making this change seems to have solved the initial problem, where scripts randomly hang up, so thank you Miruna. I am still interested in hearing why and how this makes a difference.

0 0
replied on May 29, 2014

Interestingly, your question includes the answer to your 2nd point: activity Deadline ;-)

0 0
replied on May 29, 2014

I thought a deadline waits on a waiting conditions only. It will work for a running activity?

0 0
replied on May 30, 2014

No, it won't. Your title could be read either as "how do i set a timeout for scripts" or as 2 separate questions ("what am i waiting for" and "how to set a deadline"), so I think that's what confused Louis.

0 0
replied on May 30, 2014

Ok what I have done is prevented any workflows from running simultaneously. I remembered running into this awhile ago only with script activities and when workflows were allowed to run simultaneously. It must now run them one at a time, since they run so quickly it is not too much of a performance hit.

0 0
replied on June 5, 2019

Reviving this thread, I have two situations where this exact same thing happens.  The workflow invokes a script, and then get hung up waiting for the script to finish.  When we restart the Workflow Server, all of the instances that are stalled then finish without issue.  But as they say, "that ain't no way to run a railroad."

It is as if the script completed, but Workflow never got the message.  The frequency is roughly 1 in 1000 WF instances.  Question:  in 10.3 / 10.4 this:

Try going into the WF Admin Console under Server Options, the Server Configuration node and open the Advanced Server Options dialog. In the Activity Performance tab, uncheck the box labeled "Script activities".

is no longer an option.  What was the role of that option, and has it been replaced?  Are there any good remedies to this problem?

 

Thanks -

0 0
replied on June 6, 2019

Scripts are run as separate tasks. If one stalls it could backlog the rest of them since there's a limited number of slots for tasks. They're supposed to time out after 30 seconds, but this is controlled by an option in Scripting Options. We'd have to look at what your settings are.

Restarting the Workflow Server clears out all running tasks, so the rest of the workflows can proceed.

Without knowing what the script is doing, it's not really possible to tell why it's hanging.

I'm not really sure what you mean about the Activity Performance tab. The checkbox is there in both 10.2 and 10.4 (there's no WF 10.3).

0 0
replied on June 6, 2019 Show version history

Thanks, Miruna -

I did find the dialog you posted by double clicking.  What is the difference in running a script as a task, vs. not running it as a task?  As far as the script goes, we did not change the time out default.  The script itself works with a value from a database, which will be either 7 or 8 characters long.  If it's 7 we zero fill it and then parse the date from a 01012019 format to 01/01/2019.  There is nothing here that I can see that would actually hang - it's just a bunch of independent If statements:

Dim OrderDate as String = GetTokenValue("LookUpWinBill_date ordered").ToString.Trim

            'Fail the script
            If OrderDate.Length < 7 then
                  SetTokenValue("OrderDate", "")
                  Exit Sub
            End If

            'Months are not zero filled
            If OrderDate.Length = 7 then
                 OrderDate = "0" + OrderDate
            End If

            'Extract the date and format it
            If OrderDate.Length = 8 Then
                OrderDate = OrderDate.Substring(0, 2) + "/" + OrderDate.Substring (2, 2) + "/" + OrderDate.Substring (4, 4)
                SetTokenValue("OrderDate", OrderDate)
            End If

 

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.