Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not settings.getboolean('worker', 'KTOOLS_ERROR_GUARD'):
run_args.append('--ktools-disable-guard')
if settings.getboolean('worker', 'DEBUG_MODE'):
run_args.append('--verbose')
logging.info('run_directory: {}'.format(oasis_files_dir))
logging.info('args_list: {}'.format(str(run_args)))
# Log MDK run command
args_list = run_args + [''] if (len(run_args) % 2) else run_args
mdk_args = [x for t in list(zip(*[iter(args_list)] * 2)) if (None not in t) and ('--model-run-dir' not in t) for x in t]
logging.info("\nRUNNING: \noasislmf model generate-losses {}".format(
" ".join([str(arg) for arg in mdk_args])
))
GenerateLossesCmd(argv=run_args).run()
output_location = uuid.uuid4().hex + ARCHIVE_FILE_SUFFIX
output_directory = os.path.join(run_dir, "output")
with tarfile.open(os.path.join(settings.get('worker', 'MEDIA_ROOT'), output_location), "w:gz") as tar:
tar.add(output_directory, arcname="output")
logging.info("Output location = {}".format(output_location))
return output_location