-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Having an intermittent issue when uploading subjects via the python client. No indication that I am losing network connectivity. I spawn up to 20 processes working on preparing subjects from individual files, then all uploading to the same subject set. I basically create the subject, add the png file, get the subject id, add that to the already prepared dictionary with the manifest, then add the manifest to the subject. Once all subjects are complete, I try to add them to the proper subject set where I sometimes get this error:
panoptes_client.panoptes.PanoptesAPIException: Attempted to touch a stale object: SubjectSet.
Relevant code snippet is:
lNewSubjects = []
for det in dManifest:
s=Subject()
s.links.project=project.id
s.links.subject_set=subject_set.id
for filename in dManifest[det]['sImageFilenames']:
pngFilename = var.sWorkingDirectory + filename.rstrip('.arch.fz') + '_' + det + '.png'
#Catch for any subject with less than max number of files
if os.path.isfile(pngFilename):
s.add_location(pngFilename)
if var.bUpload:
s.save()
dManifest[det]['iSubjectId'] = int(s.id)
s.metadata.update(dManifest[det])
s.save()
lNewSubjects.append(s)
#subject_set.add(s)
else:
dManifest[det]['iSubjectId'] = None
if var.bUpload:
try:
subject_set.add(lNewSubjects)
except Exception as ex:
var.logger.error('SUBJECTUPLOAD Error: ' + str(ex))
var.logger.error(traceback.format_exc())
Is it not possible to add subjects to a subject set from simultaneous processes?
Thanks for any info!
Metadata
Metadata
Assignees
Labels
No labels