AWS Thinkbox Discussion Forums

PreTaskScript vs DeadlineCommand Python Script not working as intended

Hi everyone,

I’ve written a small python script as PreTaskScript for Deadline.
The script is creating a file via tasklist command in windows command line, using >c:\Path\to\OutputFile.txt

For example:

import subprocess

def __main__ () :
    user="whateveryouneed"

    ssh_command = [
        "tasklist",
        "/nh",
        "/fi", "WINDOWTITLE eq whatever",
        "/fo", "csv",
        ">c:\\logs\\{}\\whatever.log".format(user),
    ]
    subprocess.call(ssh_command, shell=True)

When I run this command with DeadlineCommand everything works fine
When running this as PreTaskScript in Deadline nothing happens.
Ich changed the th path to tasklist to be absolute instead of command only,
I changed the command to a simple dir or just tried to us start cmd to open a windows command line window.
All of those are working fine with DeadlineCommands, but none of them is working from within a PreTaskScript.

Everything else I am doing with the PreTaskScript, like running another program or reading the logfile from above or even deleting it, is working as intended. So the PreTaskScript is working.

Are windows commands blocked? UAC is turned of one the slaves.

What am I overlooking?

Thanks
Best regards
C.

Nothing jumps out at me, but is there anything in the worker log while it should be running this script? If you don’t have it in a try/catch I’d expect any failures by subprocess.call to bubble up but maybe not.

Privacy | Site terms | Cookie preferences