def parse_arguments()

in content/rendering-with-batch/batch/batch.files/job_submission.py [0:0]


def parse_arguments():
    """Parses the command line arguments and stores the values in global variables.
    """

    parser = argparse.ArgumentParser(description='Submit an AWS Batch job that will render a Blender file in a distributed fashion.')
    parser.add_argument('-i', dest='input_uri', type=str, required=True, help='S3 URI where the blender file is located')
    parser.add_argument('-o', dest='output_uri', type=str, required=True, help='S3 URI where to upload the rendered file')
    parser.add_argument('-f', dest='f_per_job', type=int, required=True, help='Number of frames that each job has to render')
    parser.add_argument('-n', dest='job_name', type=str, required=True, help='Name of the job that will be submitted to Batch')
    parser.add_argument('-q', dest='job_queue', type=str, required=True, help='Queue to which the job is submitted')
    parser.add_argument('-d', dest='job_definition', type=str, required=True, help='Job definition used by the submitted job')
    args = parser.parse_args()

    if args.f_per_job < 1:
        print('F_PER_JOB must be a positive integer')
        sys.exit(2)

    global INPUT_URI
    INPUT_URI = args.input_uri
    global OUTPUT_URI
    OUTPUT_URI = args.output_uri
    global F_PER_JOB
    F_PER_JOB = args.f_per_job
    global JOB_NAME
    JOB_NAME = args.job_name
    global JOB_QUEUE
    JOB_QUEUE = args.job_queue
    global JOB_DEFINITION
    JOB_DEFINITION = args.job_definition
    global FILE_NAME
    FILE_NAME = INPUT_URI.split('/')[-1]