Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
log_file = ".".join(job_file.split(".")[:-1]) + ".log"
# Get computing configuration from config
if computing_configuration is None:
try:
computing_configuration = _CONFIG["preferences"]["computing_configuration"]
except KeyError:
msg = "'computing_configuration' was not given"
msg += " and default could not be get from config."
hint = " Pass a value or add one to the section"
hint += " preferences:computing_configuration'"
hint += " in the ngs_toolkit config file."
_LOGGER.error(msg + hint)
raise
dcc = divvy.ComputingConfiguration()
if computing_configuration is not None:
dcc.activate_package(computing_configuration)
# Generate job script
d = {"code": code, "logfile": log_file}
d.update(kwargs)
dcc.write_script(job_file, d)
# Submit job
if not dry_run:
scmd = dcc["compute"]["submission_command"]
cmd = scmd.split(" ") + [job_file]
# simply submit if not limiting submission to the number of already running jobs
if not limited_number:
subprocess.call(cmd)
return path
def _req_input_to_args(req_input):
"""
Given a list of the required inputs for the build command, create an args
string
:param list[str] req_input: input names
:return str: args string
"""
return ["--" + x + " " for x in req_input]
subdir_path = _make_sub_dir(args.path, args.genome)
dcc = divvy.ComputingConfiguration()
dcc.activate_package("slurm")
cmd_template = "refgenie build -g {g} -a {a} {req_input_str}"
genome = args.genome
to_remove = ["genome", "path"]
data = vars(args)
for i in to_remove:
data.pop(i)
for asset in asset_build_packages:
sub_script = os.path.join(subdir_path, asset + ".sub")
req_input = asset_build_packages[asset]["required_inputs"]
if req_input:
print("{} asset requires additional input in the command ({}), so '{}'"
" requires manual edit".format(asset, req_input, sub_script))
req_str = " ".join(_req_input_to_args(req_input))