in pygenie/jobs/presto.py [0:0]
def cmd_args(self):
"""
The constructed command line arguments using the job's definition. If the
command line arguments are set explicitly (by calling
:py:meth:`command_arguments`) this will be the same.
"""
if self._command_arguments is not None:
return self._command_arguments
filename = PrestoJob.DEFAULT_SCRIPT_NAME
if is_file(self._script):
filename = os.path.basename(self._script)
self._add_dependency(self._script)
elif self._script is not None:
if not self._script.strip().endswith(';'):
#\n ensures if the script ends with a comment ; still gets applied
self._script = '{}\n;'.format(self._script)
self._add_dependency({'name': filename, 'data': self._script})
options_str = ' '.join([
'--{name}{space}{value}' \
.format(name=k,
value=v if v is not None else '',
space=' ' if v is not None else '') \
for k, v in self._command_options.get('--', {}).items()])
sessions_str = ' '.join([
'--session {}={}'.format(k, v) \
for k, v in self._command_options.get('--session', {}).items()])
return '{sessions} {options} -f {filename} {post_cmd_args}' \
.format(sessions=sessions_str,
options=options_str,
filename=filename,
post_cmd_args=' '.join(self._post_cmd_args)) \
.strip()