示例#1
0
def identity_and_match_processed_procedures():
    broker = Factories.celery_factory()
    wf = Services.workflow()
    logger = Core.logger()
    procedures = wf.update_processed_procedures()
    for proc in procedures:
        logger.info('Processed procedure %(uid)s has been sent to matching' %
                    ({
                        'uid': proc
                    }))
        produce_matching_task(broker, proc)
示例#2
0
 def setUp(self):
     super(StorageTestCase, self).setUp()
     data = {
         'webdav': {
             'options': {},
             'client_options': {}
         },
     }
     set_configuration(data)
     self.storage = Services.storage(wf=Services.workflow())
     self.mockDavClientMethods()
示例#3
0
def wrapped_process_image(uid, metadata):
    """
    Handles processing from bytes retrieval to result persistence.

    Keywords:
    uid -- Image uid
    metadata -- Computation request payload sent w/o pixelmap
    """
    req = StorageClient.get_image({'Content-Type': 'application/json'}, uid)
    image = req.json().get('bytes')
    metadata['image'] = image
    wf = Services.workflow()
    metrics, processed_image = wf.process_image(uid, metadata)
    return metrics, processed_image
示例#4
0
 def test_match_procedure_images(self):
     (issuer, repository, exam, exam_status, procedure, procedure_status,
      modality_type, sop_class, image_metadata, image, image_status,
      image_metrics,
      image_metrics_display) = self.create_processed_image_stack()
     wf = Services.workflow()
     wrapper = ResultWrapper()
     wrapper.EXPECTED_RESPONSE = 'Retry called'
     # Prevents logger to log exception as expected in unittests
     when(Core.logger()).exception(...).thenReturn(None)
     when(Core.logger()).warning(...).thenReturn(None)
     when(wf).match_procedure(...).thenRaise(Exception())
     (when(matching.match_procedure_images).retry(...).thenAnswer(
         wrapper.exec))
     matching.match_procedure_images(procedure.uid)
     self.assertEqual(wrapper.RESPONSE, wrapper.EXPECTED_RESPONSE)
     unstub()
示例#5
0
 def setUp(self):
     when(Core.logger()).warning(...).thenReturn(None)
     super(WorkflowTestCase, self).setUp()
     self.wf = Services.workflow()
示例#6
0
 def storage_context(self):
     yield Services.storage(wf=Services.workflow())
示例#7
0
 def wf_context(self):
     yield Services.workflow()
示例#8
0
def wrapped_match_procedure_images(procedure_uid):
    wf = Services.workflow()
    wf.match_procedure(procedure_uid)