Slave Script to copy a file

I am having trouble with a script to copy a file from the NAS to a slaves local disk, overwriting if necessary.

I am using the slave script. Machines are Windows only.

I see there is ClientUtils.ExecuteCommand() how does this know what machine it it supposed to be executing the command on?

any hints would be great.

Thanks,

Rhys.

Here is what I have so far:

It doesn’t do anything when I run it.
Where would I find any errors?

from System.IO import *
from Deadline.Scripting import *
from Deadline.Events import *

import traceback

def __main__():

    src = '\\\\mako\\TOOLS\\deadline\\max2014_data\\plugin.ini'
    dst = 'c:\\'
        
    machineNames = SlaveUtils.GetMachineNames(selectedSlaveInfos)
    for machineName in machineNames:
        machineName = currSlaveName.strip()
        SlaveUtils.SendRemoteCommand( machineName, "\"cmd\" /C xcopy " + src + " " + dst)

Are you running Deadline 5 or 6? In version 6, there is a new Console panel in the Monitor that you can use to easily see script errors. If you’re still using version 5, you can just check the Monitor’s log, which you can find from the Monitor by selecting Help -> Explore Log Folder.

The first thing that catches my eye is that you’re passing “selectedSlaveInfos” to SlaveUtils.GetMachineNames(), but “selectedSlaveInfos” hasn’t been set to anything yet. Instead, you could just do this:

machineNames = MonitorUtils.GetSelectedSlaveNames()

Hope this helps!

  • Ryan

Deadline 6

I changed that line as per your suggestion.

when I run the script (by rightclicking on a slave) I seem to drop into an endless loop of some sort.

Here is the console output. It goes on forever.

2013-06-18 09:26:22: Main Window shown 2013-06-18 09:26:36: Traceback (most recent call last): 2013-06-18 09:26:36: File "DeadlineUI\UI\Commands\ScriptCommands.py", line 80, in InnerExecute 2013-06-18 09:26:36: Exception: Python Exception: SyntaxError : (Python.Runtime.PythonException) 2013-06-18 09:26:36: Type: <type 'exceptions.SyntaxError'> 2013-06-18 09:26:36: Value: ('invalid syntax', ('none', 23, 4, ' ')) 2013-06-18 09:26:36: Stack Trace: 2013-06-18 09:26:36: 2013-06-18 09:26:36: 2013-06-18 09:26:36: at FranticX.Scripting.PythonNetScriptEngine.a(Exception A_0) 2013-06-18 09:26:36: at FranticX.Scripting.PythonNetScriptEngine.ExecuteScript(String scriptName, String script) 2013-06-18 09:26:36: at Deadline.Scripting.DeadlineScriptManager.CreateScopeFromScript(String scopeName, String scriptName, String script, Boolean addGlobalFunctions, Boolean redirectToScriptManagerListener) 2013-06-18 09:26:36: at Deadline.Scripting.DeadlineScriptManager.CreateScopeFromScript(String scopeName, String scriptName, String script, Boolean addGlobalFunctions) 2013-06-18 09:26:37: RuntimeError 2013-06-18 09:26:37: : 2013-06-18 09:26:37: wrapped C/C++ object of type QListView has been deleted 2013-06-18 09:26:37: 2013-06-18 09:26:38: RuntimeError 2013-06-18 09:26:38: : 2013-06-18 09:26:38: wrapped C/C++ object of type QListView has been deleted 2013-06-18 09:26:38: 2013-06-18 09:26:39: RuntimeError 2013-06-18 09:26:39: : 2013-06-18 09:26:39: wrapped C/C++ object of type QListView has been deleted 2013-06-18 09:26:39: 2013-06-18 09:26:40: RuntimeError 2013-06-18 09:26:40: : 2013-06-18 09:26:40: wrapped C/C++ object of type QListView has been deleted 2013-06-18 09:26:40: 2013-06-18 09:26:41: RuntimeError 2013-06-18 09:26:41: : 2013-06-18 09:26:41: wrapped C/C++ object of type QListView has been deleted 2013-06-18 09:26:41: .............. SNIP ..................

Even the simplest script seems to drop into that endless loop:

[code]from System.IO import *
from Deadline.Scripting import *
from Deadline.Events import *

import traceback

def main():

machineNames = MonitorUtils.GetSelectedSlaveNames()
for machineName in machineNames:
    machineName = machineName.strip()
    print machineName[/code]

This one prints the machine name ‘REND040’ then just starts with the endless error over and over again

2013-06-18 09:26:37: wrapped C/C++ object of type QListView has been deleted
2013-06-18 09:26:37:
2013-06-18 09:26:38: RuntimeError

Hmm, I can’t seem to reproduce this loop with the script you provided. Does it still happen if you restart the Monitor?

I also don’t get the syntax error. Maybe you could upload the script file that produces that syntax error?

weird.

Yes, I was restarting between each try.

I fixed the syntax error, it was coming from this line:
machineName = currSlaveName.strip()

currSlaveName hadn’t been defined.

I am still having this problem. I can’t even get the simplest script to not trigger that error loop.
Weirdly when I run one of the shipping scripts, they don’t cause it.

If you copy paste the last script I pasted, do you not get the error? Because I do.

Here is what we are running:
Deadline Version: 6.0.0.51480
FranticX Version: 2.0.0.51478

That’s what I did. That’s why I was asking for the script file itself, in case it had something to do with the file.

However, I just noticed this:

That’s not the release version, it’s an older beta version. I would suggest upgrading to the release version (6.0.61561) and see if the problem persists. You can contact our Sales team to get the latest installers:
thinkboxsoftware.com/sales/

Cheers,

  • Ryan

I have included the file this time.

I had placed it in repository\scripts\Slaves
I have tried on a brand new computer with the latest build of deadline 6. Still the same error.

OS is Windows 7 -64

I do have python27 and python33 installed on the machine as well - doubt that makes a difference though.
test.rar (243 Bytes)

I dropped that script into our repository\scripts\Slaves folder, selected 5 slaves, ran it from the right click menu, and it worked fine. I tested with the release version (6.0.0.51561), and our internal updated version, and in both cases it worked as expected.

Do you get the original error you posted at the beginning, or is it different with this script? The reason I ask is that the error is complaining about invalid syntax at line 23, but your script only has 12 lines. Can you run this script again, and then upload the Monitor’s log file? You can find it by selecting Help -> Explore Log Folder in the Monitor.

Cheers,

  • Ryan