Commit b8acc32f authored by Samuel GAIST's avatar Samuel GAIST

[experiments][models][experiments] Fix single letter code

This makes it easier to parse and understand.
parent 120b2a42
......@@ -634,53 +634,53 @@ class Experiment(Shareable):
)
# Ties the block in
b = Block.objects.filter(experiment=self, name=block_name).first()
if b is None:
b = Block(experiment=self, name=block_name, algorithm=algorithm)
block = Block.objects.filter(experiment=self, name=block_name).first()
if block is None:
block = Block(experiment=self, name=block_name, algorithm=algorithm)
else:
b.algorithm = algorithm
b.execution_order = order_0 + 1
b.command = simplejson.dumps(job_description, indent=4)
b.status = Block.PENDING
b.analyzer = algorithm.analysis()
b.environment = env
b.queue = queue
b.required_slots = job_description["nb_slots"]
b.channel = job_description["channel"]
b.save()
block.algorithm = algorithm
block.execution_order = order_0 + 1
block.command = simplejson.dumps(job_description, indent=4)
block.status = Block.PENDING
block.analyzer = algorithm.analysis()
block.environment = env
block.queue = queue
block.required_slots = job_description["nb_slots"]
block.channel = job_description["channel"]
block.save()
# from this point: requires block to have an assigned id
b.dependencies.clear()
b.dependencies.add(
block.dependencies.clear()
block.dependencies.add(
*[self.blocks.get(name=k) for k in description["dependencies"]]
)
# reset inputs - creates if necessary only
b.inputs.clear()
for v in job_description["inputs"].values():
if "database" in v: # database input
block.inputs.clear()
for input_ in job_description["inputs"].values():
if "database" in input_: # database input
db = DatabaseSetOutput.objects.get(
set__hash=v["hash"], template__name=v["output"]
set__hash=input_["hash"], template__name=input_["output"]
)
BlockInput.objects.get_or_create(
block=b, channel=v["channel"], database=db
block=block, channel=input_["channel"], database=db
)
else:
cache, _ = CachedFile.objects.get_or_create(hash=v["hash"])
cache, _ = CachedFile.objects.get_or_create(hash=input_["hash"])
BlockInput.objects.get_or_create(
block=b, channel=v["channel"], cache=cache
block=block, channel=input_["channel"], cache=cache
)
# reset outputs - creates if necessary only
b.outputs.clear()
block.outputs.clear()
outputs = job_description.get(
"outputs", {"": job_description.get("result")}
)
for v in outputs.values():
cache, cr = CachedFile.objects.get_or_create(hash=v["hash"])
cache.blocks.add(b)
for output in outputs.values():
cache, cr = CachedFile.objects.get_or_create(hash=output["hash"])
cache.blocks.add(block)
# _____ Methods __________
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment