You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
We use conditional requests to ensure a client doesn't clobber another clients changes.
As such you'll need to reload the subject set to get a refreshed view with the updated changes (most likely new linked subjects count or similar) before trying to add the new batch of subjects.
Running these requests concurrently creates a race condition of state changes, you may have to add an exception handler with some retry logic to correctly handle this issue as it could be unpredictable.
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:
Relevant code snippet is:
Is it not possible to add subjects to a subject set from simultaneous processes?
Thanks for any info!
The text was updated successfully, but these errors were encountered: