AWS Thinkbox Discussion Forums

remote commands in 'vanilla' environment

Seems like spawning remote commands from the launcher inherits the environment of the deadline launcher.

Could this be changed? It means we have to encapsulate executions in custom code that wipes deadline env variables (pythonpath etc).

For the life of me, i cant figure out whats going wrong.

But if i start an executable from the explorer on the machine, its running properly. If i start it via a remote command, it just hangs. Its a py2exe compiled python script. I tried wiping the environment, tried setting the environment of a machine that i know to be working, but nothing helps.

Its also a bit weird, that even though im spawning a subprocess in python using os.spawnle with NO_WAIT, the remote command doesn’t say “Succeeded”.

The command is something like this:

c:\python26_64\python forceRestartMonitor.py

This script runs a subprocess using os.spawnle with the NO_WAIT command, then quits.
Yet, deadline is waiting for that subprocess to quit…

The only way i could get this to work, i running the application as a scheduled task. Feels so wrong. hah

sAppName = ‘task name’
sAppPath = ‘my application to run’

os.system(r’schtasks /CREATE /SC ONCE /ST 00:00 /TN %s /TR %s’ % (sAppName, sAppPath))
os.system(r’schtasks /Run /TN “%s”’ % sAppName)
os.system(r’schtasks /Delete /F /TN “%s”’ % sAppName)

Can you post the python script, as well as the remote command you are executing? We can do some digging on our end and try to find out if we’re doing anything that would cause this.

Glad to hear you have a workaround for now though. :slight_smile:

Thanks!

command was something like this:
cmd /c “start /i c:\python26_64\python.exe <path_to_script>\script.py”

Then script.py was something like:

import os
os.spawnle(os.P_NOWAIT, r’C:\Windows\system32\calc.exe’,r’C:\Windows\system32\calc.exe’,os.environ)

Something along these lines. Till you manually quit calc.exe, (even though the cmd.exe returns right away), it would ‘hang’ the launcher.

Thanks! We’ve logged this as an issue and will look into it.

Cheers,
Ryan

Related to the original question here, it seems that a PYTHONPATH environment variable is set for everything executed by the slave:

2014-09-18 15:23:04: 0: PYTHON: PYTHONPATH=C:\Program Files\Thinkbox\Deadline7\bin\lib;C:\Program Files\Thinkbox\Deadline7\bin\Dlls

Could this not be set?
Otherwise we cant run any of our pipeline script via deadline7 without hardcoding every script & batch file etc to gut that pythonpath variable :frowning:

For now, i made a ‘fake’ event plugin that gets triggered left&right by deadline and clears PYTHONPATH :slight_smile:

First time im glad for not having an encapsulated python environment, cause now these settings stick haha:

from Deadline.Events import *
from Deadline.Scripting import *

import os

###############################################################
## This is the function called by Deadline to get an instance of the Draft event listener.
###############################################################
def GetDeadlineEventListener():
    return ScanlineEventListener()

def CleanupDeadlineEventListener( eventListener ):
    pass

###############################################################
## The Draft event listener class.
###############################################################
class ScanlineEventListener (DeadlineEventListener):
    def __init__( self ):
        ClientUtils.LogText( "ScanlineEventListener __init__ called" )
        self.CleanEnvironmentVariables()

    def CleanEnvironmentVariables( self ):
        if 'PYTHONPATH' in os.environ.keys():
            del os.environ['PYTHONPATH']

This is something we still want to look into, as per this thread:
viewtopic.php?f=205&t=12272

Cheers,
Ryan

Privacy | Site terms | Cookie preferences