Skip to content
Snippets Groups Projects
Commit 371b5e0d authored by Megan Henning's avatar Megan Henning
Browse files

Fix bugs

parent d785cd38
No related branches found
No related tags found
No related merge requests found
......@@ -150,22 +150,24 @@ def is_session_compliant(session, template):
Return True if container satisfies requirements.
Return False otherwise.
"""
log.debug('entering with {} {}'.format(cont, reqs))
for req_k, req_v in reqs.iteritems():
if req_k == 'files':
file_reqs = req_v
min_count = file_reqs.pop('minimum')
count = 0
for f in cont.get('files', []):
if not check_cont(f, req_v):
# Didn't find a match, on to the next one
continue
else:
count += 1
if count >= min_count:
break
if count < min_count:
return False
for fr in req_v:
fr_temp = fr.copy() #so subsequent calls don't have their minimum missing
min_count = fr_temp.pop('minimum')
count = 0
for f in cont.get('files', []):
if not check_cont(f, fr_temp):
# Didn't find a match, on to the next one
continue
else:
count += 1
if count >= min_count:
break
if count < min_count:
return False
else:
if not check_req(cont, req_k, req_v):
......
......@@ -237,7 +237,8 @@ class EnginePlacer(Placer):
###
# Remove when switch to dmv2 is complete across all gears
if self.context.get('job_id') and self.metadata.get(self.container_type):
c_metadata = self.metadata.get(self.container_type, {})
if self.context.get('job_id') and c_metadata and not c_metadata.get('files', []):
job = Job.get(self.context.get('job_id'))
input_names = [{'name': v.name} for k,v in job.inputs.iteritems()]
......@@ -281,8 +282,7 @@ class EnginePlacer(Placer):
saved_file_names = [x.get('name') for x in self.saved]
for file_md in file_mds:
if file_md['name'] not in saved_file_names:
# Updating file that already exists
hierarchy.update_fileinfo(self.container_type, self.id_, file_md)
hierarchy.update_fileinfo(self.container_type+'s', bid, file_md)
# Remove file metadata as it was already updated in process_file_field
for k in self.metadata.keys():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment