Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   RUNPROGRAM_PROCESSID issue (https://www.kinook.com/Forum/showthread.php?t=4874)

CREvans 06-03-2011 01:06 PM

RUNPROGRAM_PROCESSID issue
 
I'm trying to do some parallel tasks and am using a method similar to the example chain.bld program. This works as long as the child builds are set to not wait for completion. However, if I set them (either accidently or on purpose) to wait until completion the vbld_StepDone() fails because the RUNPROGRAM_PROCESSID macro doesn't get created. It appears as if this macro is only being created if the child is not set to wait until completion before continuing.

I know typically one wouldn't want to run things in parallel, but have one of the tasks wait until completion, but we are.

Is this a bug, or expected behavior? I can code around the issue if needed, but want to wait to make sure it's not a bug first.

Thanks!
Scott

kinook 06-03-2011 02:05 PM

It is by design that no RUNPROGRAM_PROCESSID macro is created when a step that runs a program is configured to wait for until completion.
http://www.kinook.com/VisBuildPro/Ma...gramaction.htm

There's not really a use for the ID, since the process will already be gone when the step completes...

CREvans 06-03-2011 02:14 PM

I can see the point in that, but it makes dealing with different scenarios a bit more difficult, in case someone checks the "wait until completion" box, the dependency on that macro being there will fail. For anyone else who might come across this sort of error in the future and is searching the Forums for a resolution, here is what I ended up doing, to handle whether the RUNPROGRAM_PROCESSID exists or not. It is assumed that there won't be a process numbered 999999 out there, which is why I chose that number to default to.


Sub vbld_StepDone()

' store this step's process ID in another temporary macro
if vbld_AllMacros()("RUNPROGRAM_PROCESSID") is nothing then
vbld_TempMacros().Add "Child_ID", "999999"
else
vbld_TempMacros().Add "Child_ID", vbld_TempMacro("RUNPROGRAM_PROCESSID").Value
end if

End Sub

kinook 06-03-2011 02:56 PM

I would recommend something more like:
Code:

If Step.Property("wait") Then
  ' if waiting, there is no process id, just store an empty string
  vbld_TempMacros().Add "Child_ID", ""
Else
  vbld_TempMacros().Add "Child_ID", vbld_TempMacro("RUNPROGRAM_PROCESSID").Value
End If



All times are GMT -5. The time now is 02:31 PM.


Copyright © 1999-2023 Kinook Software, Inc.