PDA

View Full Version : Prevent Multiple Builds Running at Same Time


ktak
11-19-2009, 07:50 PM
As the title says:
If there is a build running already and another instance starts up (lets say from a scheduler), I want the new instance to detect that there is a build running already and exit gracefully.

Is there a global variable that i can use to set conditions?

kinook
11-19-2009, 09:42 PM
http://www.kinook.com/VisBuildPro/Manual/singleinstancesample.htm

ktak
11-25-2009, 01:20 PM
Looking at the SingleInstance example, I am getting incorrect behavior on the step to clear the "stale marker".

The conditional expression for that step is the following:

[DateDiff("h", Now, vbld_ParseFormattedDateTime(vbld_GetFileContents("E:/scripts/markerfile"))) >1]
(is true)

if the date is over 1 hour it should delete the marker file.


The marker file I am using for this example has this date inside of it:
D20091125T094945

I made sure that the marker file is way older than 1 hour, however the condition didn't evaluate to true.

Afterwards, I entered this line in a run script step to see what dates were getting sent in as parameters for the DateDiff function.

var t = vbld_ParseFormattedDateTime(vbld_GetFileContents("E:/scripts/markerfile"));
Builder.LogMessage(t);

Surprisingly, I got a time stamp off by a month.
"Fri Dec 25 09:49:45 PST 2009"

I checked my machine to make sure the system clock is correct, and it was.

Is this a bug on VBP?

kinook
11-25-2009, 02:01 PM
Looks like that should be

[DateDiff("h", vbld_ParseFormattedDateTime(vbld_GetFileContents("E:/scripts/markerfile")), Now) >1]

or

[Abs(DateDiff("h", Now, vbld_ParseFormattedDateTime(vbld_GetFileContents("E:/scripts/markerfile")))) >1]