def get_deadline_command()

in packages/aws-rfdk/lib/deadline/scripts/python/client-rq-connection.py [0:0]


def get_deadline_command():
    """
    Find the Deadline executable on the current machine

    :return: the string path to the Deadline executable.
    """

    deadline_bin = ""
    try:
        deadline_bin = os.environ['DEADLINE_PATH']
    except KeyError:
        # if the error is a key error it means that DEADLINE_PATH is not set. however Deadline command may be in the PATH or on OSX it could be in the file /Users/Shared/Thinkbox/DEADLINE_PATH
        pass

    # On OSX, we look for the DEADLINE_PATH file if the environment variable does not exist.
    if deadline_bin == "" and os.path.exists("/Users/Shared/Thinkbox/DEADLINE_PATH"):
        with open("/Users/Shared/Thinkbox/DEADLINE_PATH") as f:
            deadline_bin = f.read().strip()

    deadlineCommand = os.path.join(deadline_bin, "deadlinecommand")

    return deadlineCommand