launch a process

Hi, we have a problem with Nuke and samba here. Sometimes Samba will lock a file preventing Nuke for rendering the frame.

I have modified the Nuke plugin to trap the lock file error… this works fine. Now I would like to launch a subprocess to delete the lock file using rsh or some other process.

Can I use the ProcessUtils.SpawnProcess() function to achieve this in the plugin? is there a better way to do this?

thanks

ok I got it. Using the c# class Process I can launch a process using Process.Start()
and wait for the output using process.WaitForExit()

Right now I am testing with fcheck as a subprocess… and I am trying to get the task to requeue instead of failing…

any tips to achieve this?

here is my handler so far.
def HandleLockFrames( self ):
LogInfo(“Deleting locked file and relaunching render. (” + self.GetRegexMatch(1) + “)”)
process = Process.Start(“fcheck.exe”, self.GetRegexMatch(1))
process.WaitForExit()
LogInfo(“process return:” + str(process))
ExitWithSuccess()

I am trapping the error, launching a process (will be delete the lock file and rename the .tmp render )
then I want to return success… but the task always fails.

Here is the error returned:
0: STDOUT: Writing M:/Production/Staff/Users/sylvain.berger/Projects/Nuke/Nuke_benchmark/renders/AT201_112_comp_benchmark_v004.0005.jpg .5.6
0: STDOUT: Writing M:/Production/Staff/Users/sylvain.berger/Projects/Nuke/Nuke_benchmark/renders/AT201_112_comp_benchmark_v004.0005.jpg took 19.39 seconds
0: STDOUT: Total render time: 19 seconds
0: INFO: Deleting locked file and relaunching render. (M:/Production/Staff/Users/sylvain.berger/Projects/Nuke/Nuke_benchmark/renders/AT201_112_comp_benchmark_v004.0005.jpg)
Scheduler Thread - Render Thread 0 threw an error:
Scheduler Thread - Exception during render: An error occurred in RenderTasks(): Process has exited, so the requested information is not available. (System.InvalidOperationException) (Deadline.Plugins.RenderPluginException)

I wonder if this line is causing the error:

LogInfo("process return:" + str(process))

When trying to convert the process to a string, it might be accessing information that’s only available when the process is running. Try commenting out this line for now to see if it at least exits with success.

Cheers,

  • Ryan

ho yeah…i finally figured out that this was causing the crash… I finally got it working.