in content/rendering-with-batch/batch/batch.files/job_submission.py [0:0]
def submit_rendering_job(n_frames, array_size):
"""Submits a Batch job that renders the frames.
Depending on the value of <array_size>, it will submit either
a single job or an array job
Keyword arguments:
n_frames -- total number of frames
array_size -- size of the array job
"""
# Append the name of the job to the URI so that a folder is created in S3
full_output_uri = '{}/{}'.format(OUTPUT_URI, JOB_NAME)
client = boto3.client('batch')
command = 'render -i {} -o {} -f {} -t {}'.format(INPUT_URI, full_output_uri, F_PER_JOB, n_frames)
kwargs = build_job_kwargs('{}_Rendering'.format(JOB_NAME), command.split())
# If this is not a single job, submit it as an array job
if array_size > 1:
kwargs['arrayProperties'] = {
'size': array_size
}
try:
return client.submit_job(**kwargs)
except Exception as e:
print(e.args[0])
sys.exit(2)