SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Job getting stuck in queue
Goto page 1, 2  Next
 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Job getting stuck in queue
Author Message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Job getting stuck in queue Reply with quote
Hi

I've noticed that a windows version job of mine gets stuck in it's queue now and then, although it's not predictably timed or prompted as far as I can see.

The job is jal, synchronous, attached, and in a queue with subsequent jobs. it runs all day every 3 minutes and does a fileexists check, which if the file exists triggers another job via jobrun. If the file isn't found it exits. I considered using a loop and wait, but found that this locked up the scheduler (could have been my crappy code though).

A number of times now it has stopped, it shows in the queue monitor as running but nothing is happening either visibly or in trace. subsequent instances of the job just queue up afterwards, until the scheduler is restarted or the front job is killed using queue monitor.

Any ideas what might cause that?
Thu Jun 21, 2007 6:31 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Reply with quote
Why don't you simple set a file watch schedule for this job, there will not be a need to run the job every 3 minutes just to check for a file?
Fri Jun 22, 2007 1:52 am View user's profile Send private message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Reply with quote
I haven't used a simple file watch because it needs to change the trigger file based on the date.
Sun Jun 24, 2007 6:13 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Reply with quote
Have you looked at macro-variables? They can be used in job properties including file trigger definitions.
Sun Jun 24, 2007 8:43 pm View user's profile Send private message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Reply with quote
I'm familiar with macro-parameters but unless I can initialise my own there's not a lot I can do with them in this context
Sun Jun 24, 2007 9:47 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Reply with quote
Quote:
unless I can initialise my own


You can set environment variables and then refer to them using macro-variables @V"env:MY_VAR"
The best part is that environment variables set from jobs are only visible to the scheduler and to the job processes invoked from the scheduler.
Sun Jun 24, 2007 9:52 pm View user's profile Send private message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Reply with quote
So I set them in jal using

Run (set var1=value1)

and then refer to them using the macro parameter or is there a way within Jal itself to set them?
Sun Jun 24, 2007 10:45 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Reply with quote
SET command is not a program and so cannot be run as a program. You need to use the command processor to execute it.
Code:
Dim( pid, number )
Run ( "cmd /C set var1=value1", "", 0, pid )

Sun Jun 24, 2007 10:58 pm View user's profile Send private message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Reply with quote
I've tried that, but I get syntax error in JAL when I try to reference it to test whether it's set properly.

Here are the interesting bits

setcontrol3:
Set( controlfile, "CONTROL3.txt")
GoTo setenvironmentvariable

setcontrol2:
Set( controlfile, "CONTROL2.txt")

setenvironmentvariable:
Dim( pid, number )
dim( commandline, string)
concat ("cmd /C set finish_extract_control=", controlfile, commandline)
Run ( commandline, "", pid )


dim( test, string)
set( test, @V"env:finish_extract_control")
Sun Jun 24, 2007 11:35 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Reply with quote
There are 2 issues:

1. The macro-variables are inserted into the script before it is run and the script syntax is validated. So that setting of a variable and getting it in the same script makes no sense. The value is gotten before it is set.

2. Macro-variables are substituted with their values as specified in the script. No additional quotes or symbols are inserted in place. If a value of a variable is nothing , an empty string is inserted. You can see the effect when you open the job script in the debugger. In the provided test script in the last line you get set( test, ) which is invalid syntax. The correct way to enter that is set( test, "@V"env:finish_extract_control""), which if you leave the rest of the script as is, in job run-time would result in set( test, "" )
Mon Jun 25, 2007 12:18 am View user's profile Send private message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Reply with quote
How do I test whether the run command set the variable correctly?
Mon Jun 25, 2007 12:22 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Reply with quote
Run job again in the debugger. You should see the previously set value inserted into the script before you actually start the job second time. Another method is to create 2 separate jobs - setter and getter.
Mon Jun 25, 2007 1:36 am View user's profile Send private message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Reply with quote
Ok, 2 jobs

setter

Dim( controlfile, string)
Dim( processingeomdate, string)
Dim( processingdate, string)
//check in with processingday.ini to get dates
IniFileGetKey( "d:\\POC\\processingday.ini", "Dates", "procdate", processingeomdate )
IniFileGetKey( "d:\\POC\\processingday.ini", "Dates", "proceom", processingdate )
//if it's the end of the month according to processingday.ini then set control file accordingly
Dim( endofmonth, boolean)
IsEqual( processingeomdate, processingdate, endofmonth )
If( endofmonth, setcontrol3, setcontrol2)

setcontrol3:
Set( controlfile, "CONTROL3.txt")
GoTo setenvironmentvariable

setcontrol2:
Set( controlfile, "CONTROL2.txt")

setenvironmentvariable:
Dim( pid, number )
dim( commandline, string)
concat ("cmd /C set extractcontrol=", controlfile, commandline)
Run ( commandline, "", pid )

and getter

dim blah, string
set( blah, "@V"env:extractcontrol"")

The first job appears to run without a hitch

The second, when run in debugger, sets blah as blank.

Also in the script editor the second script highlights env in red as if it's done wrong? I've tried %extractcontrol% but that didn't appear to change behaviour.
Mon Jun 25, 2007 8:34 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Reply with quote
Small correction

Instead of concat ("cmd /C set extractcontrol=", controlfile, commandline)

try
ConcatEx("cmd /C \"@echo set extractcontrol=", controlfile, " > setvar.bat\" && setvar.bat", commandline)
Mon Jun 25, 2007 10:13 pm View user's profile Send private message
LeeD



Joined: 17 May 2007
Posts: 311
Country: New Zealand

Post Reply with quote
Ok with that correction the setter still runs fine but the getter doesn't display the var. I don't need %%'s?
Mon Jun 25, 2007 11:59 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.