def storeAutoProcProgram(self, _clientToolsForAutoprocessingWebService, _xsDataAutoProcProgram): """Creates an entry in the ISPyB AutoProcProgram table""" self.DEBUG("EDPluginISPyBStoreAutoProcv1_3.storeAutoProcProgram") strProcessingCommandLine = self.getValue( _xsDataAutoProcProgram.getProcessingCommandLine(), "") strProcessingPrograms = self.getValue( _xsDataAutoProcProgram.getProcessingPrograms(), "") bProcessingStatus = self.getValue( _xsDataAutoProcProgram.getProcessingStatus(), True) strProcessingMessage = self.getValue( _xsDataAutoProcProgram.getProcessingMessage(), "") processingStartTime = self.getDateValue( _xsDataAutoProcProgram.getProcessingStartTime(), "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) processingEndTime = self.getDateValue( _xsDataAutoProcProgram.getProcessingEndTime(), "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) strProcessingEnvironment = self.getValue( _xsDataAutoProcProgram.getProcessingEnvironment(), "") recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcProgramId = _clientToolsForAutoprocessingWebService.service.storeAutoProcProgram( in0 = strProcessingCommandLine, \ in1 = strProcessingPrograms, \ in2 = bProcessingStatus, \ in3 = strProcessingMessage, \ in4 = processingStartTime, \ in5 = processingEndTime, \ in6 = strProcessingEnvironment, \ in7 = recordTimeStamp ) self.DEBUG("AutoProcProgramId: %r" % iAutoProcProgramId) return iAutoProcProgramId
def xml(self): root = Element("Timestamp", ns=wsuns) created = Element('Created', ns=wsuns) created.setText(str(DateTime(self.created))) expires = Element('Expires', ns=wsuns) expires.setText(str(DateTime(self.expires))) root.append(created) root.append(expires) return root
def translate(self, value, topython=True): if topython: if isinstance(value, six.string_types) and len(value): return DateTime(value).datetime else: return None else: if isinstance(value, dt.date): return str(DateTime(value)) else: return value
def getDateValue(self, _strValue, _strFormat, _oDefaultValue): if _strValue is None: oReturnValue = _oDefaultValue else: try: oReturnValue = DateTime( datetime.datetime.strptime(_strValue, _strFormat)) except: oReturnValue = DateTime( datetime.datetime.strptime(_strValue, _strFormat)) return oReturnValue
def xml(self): """ Get xml representation of the object. @return: The root node. @rtype: L{Element} """ root = Element('UsernameToken', ns=wssens) u = Element('Username', ns=wssens) u.setText(self.username) root.append(u) p = Element('Password', ns=wssens) p.setText(self.password) if self.password_digest: p.set("Type", wsdigest) p.setText(self.password_digest) else: p.set("Type", wstext) root.append(p) if self.nonce is not None: n = Element('Nonce', ns=wssens) if self.nonce_has_encoding: n.set("EncodingType", nonce_encoding_type) n.setText(self.nonce) root.append(n) if self.created is not None: n = Element('Created', ns=wsuns) n.setText(str(DateTime(self.created))) root.append(n) return root
def storeOrUpdateAutoProc(self, _clientToolsForAutoprocessingWebService, _xsDataAutoProc): """Creates an entry in the ISPyB AutoProc table""" iAutoProcId = self.getXSValue(_xsDataAutoProc.getAutoProcId()) iAutoProcProgramId = self.iAutoProcProgramId strSpaceGroup = self.getXSValue(_xsDataAutoProc.getSpaceGroup()) fRefinedCellA = self.getXSValue(_xsDataAutoProc.getRefinedCell_a()) fRefinedCellB = self.getXSValue(_xsDataAutoProc.getRefinedCell_b()) fRefinedCellC = self.getXSValue(_xsDataAutoProc.getRefinedCell_c()) fRefinedCellAlpha = self.getXSValue( _xsDataAutoProc.getRefinedCell_alpha()) fRefinedCellBeta = self.getXSValue( _xsDataAutoProc.getRefinedCell_beta()) fRefinedCellGamma = self.getXSValue( _xsDataAutoProc.getRefinedCell_gamma()) recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProc( arg0=iAutoProcId, \ autoProcProgramId=iAutoProcProgramId, \ spaceGroup=strSpaceGroup, \ refinedCellA=fRefinedCellA, \ refinedCellB=fRefinedCellB, \ refinedCellC=fRefinedCellC, \ refinedCellAlpha=fRefinedCellAlpha, \ refinedCellBeta=fRefinedCellBeta, \ refinedCellGamma=fRefinedCellGamma, \ recordTimeStamp=recordTimeStamp \ ) self.DEBUG("AutoProcId: %r" % iAutoProcId) return iAutoProcId
def process(self, _edObject=None): """ Uses ToolsForCollectionWebService for storing the workflow status """ EDPluginExec.process(self) self.DEBUG("EDPluginISPyBStoreWorkflowv1_4.process") # First get the image ID xsDataWorkflow = self.getDataInput().getWorkflow() httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated( username=self.strUserName, password=self.strPassWord) clientToolsForCollectionWebService = Client( self.strToolsForCollectionWebServiceWsdl, transport=httpAuthenticatedToolsForCollectionWebService) workflow3VO = clientToolsForCollectionWebService.factory.create( 'workflow3VO') workflow3VO.comments = self.getXSValue(xsDataWorkflow.comments) workflow3VO.logFilePath = self.getXSValue(xsDataWorkflow.logFilePath) workflow3VO.recordTimeStamp = self.getDateValue( xsDataWorkflow.recordTimeStamp, "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) workflow3VO.resultFilePath = self.getXSValue( xsDataWorkflow.resultFilePath) workflow3VO.status = self.getXSValue(xsDataWorkflow.status) workflow3VO.workflowId = self.getXSValue(xsDataWorkflow.workflowId) workflow3VO.workflowTitle = self.getXSValue( xsDataWorkflow.workflowTitle) workflow3VO.workflowType = self.getXSValue(xsDataWorkflow.workflowType) # print workflow3VO self.iWorkflowId = clientToolsForCollectionWebService.service.storeOrUpdateWorkflow( workflow3VO) self.DEBUG("EDPluginISPyBStoreWorkflowv1_4.process: WorkflowId=%d" % self.iWorkflowId)
def process(self, _edObject=None): """ First uses the ImageService to find the imageId. Then uses ToolsForCollectionWebService for storing the image quality indicators. """ EDPluginExec.process(self) self.DEBUG("EDPluginISPyBStoreListOfImageQualityIndicatorsv1_4.process") httpAuthenticatedToolsForAutoprocessingWebService = HttpAuthenticated(username=self.strUserName, password=self.strPassWord) clientToolsForAutoprocessingWebService = Client(self.strToolsForAutoprocessingWebServiceWsdl, transport=httpAuthenticatedToolsForAutoprocessingWebService) # Loop over all input image quality indicators: listImageQualityIndicatorsForWS = [] for xsDataImageQualityIndicators in self.dataInput.imageQualityIndicators: #print xsDataImageQualityIndicators.marshal() imageQualityIndicatorsWS3VO = clientToolsForAutoprocessingWebService.factory.create('imageQualityIndicatorsWS3VO') strPathToImage = xsDataImageQualityIndicators.getImage().getPath().getValue() imageQualityIndicatorsWS3VO.fileName = os.path.basename(strPathToImage) imageQualityIndicatorsWS3VO.fileLocation = os.path.dirname(strPathToImage) # imageQualityIndicatorsWS3VO.imageId = 0 imageQualityIndicatorsWS3VO.autoProcProgramId = self.iAutoProcProgramId imageQualityIndicatorsWS3VO.spotTotal = self.getXSValue(xsDataImageQualityIndicators.spotTotal) imageQualityIndicatorsWS3VO.inResTotal = self.getXSValue(xsDataImageQualityIndicators.inResTotal) imageQualityIndicatorsWS3VO.goodBraggCandidates = self.getXSValue(xsDataImageQualityIndicators.goodBraggCandidates) imageQualityIndicatorsWS3VO.iceRings = self.getXSValue(xsDataImageQualityIndicators.iceRings) imageQualityIndicatorsWS3VO.method1Res = self.getXSValue(xsDataImageQualityIndicators.method1Res) imageQualityIndicatorsWS3VO.method2Res = self.getXSValue(xsDataImageQualityIndicators.method2Res) imageQualityIndicatorsWS3VO.maxUnitCell = self.getXSValue(xsDataImageQualityIndicators.maxUnitCell) imageQualityIndicatorsWS3VO.pctSaturationTop50Peaks = self.getXSValue(xsDataImageQualityIndicators.pctSaturationTop50Peaks) imageQualityIndicatorsWS3VO.inResolutionOvrlSpots = self.getXSValue(xsDataImageQualityIndicators.inResolutionOvrlSpots) imageQualityIndicatorsWS3VO.binPopCutOffMethod2Res = self.getXSValue(xsDataImageQualityIndicators.binPopCutOffMethod2Res) imageQualityIndicatorsWS3VO.totalIntegratedSignal = self.getXSValue(xsDataImageQualityIndicators.totalIntegratedSignal) imageQualityIndicatorsWS3VO.recordTimeStamp = DateTime(datetime.datetime.now()) listImageQualityIndicatorsForWS.append(imageQualityIndicatorsWS3VO) self.listImageQualityIndicatorsId = clientToolsForAutoprocessingWebService.service.storeOrUpdateImageQualityIndicatorsForFileNames( listImageQualityIndicatorsForWS = listImageQualityIndicatorsForWS) self.DEBUG("EDPluginISPyBStoreListOfImageQualityIndicatorsv1_4.process: listImageQualityIndicatorsId=%r" % self.listImageQualityIndicatorsId)
def storeAutoProc(self, _clientToolsForAutoprocessingWebService, _xsDataAutoProc): """Creates an entry in the ISPyB AutoProc table""" iAutoProcProgramId = self.iAutoProcProgramId strSpaceGroup = self.getValue(_xsDataAutoProc.getSpaceGroup(), "") fRefinedCellA = self.getValue(_xsDataAutoProc.getRefinedCell_a(), -1) fRefinedCellB = self.getValue(_xsDataAutoProc.getRefinedCell_b(), -1) fRefinedCellC = self.getValue(_xsDataAutoProc.getRefinedCell_c(), -1) fRefinedCellAlpha = self.getValue( _xsDataAutoProc.getRefinedCell_alpha(), -1) fRefinedCellBeta = self.getValue(_xsDataAutoProc.getRefinedCell_beta(), -1) fRefinedCellGamma = self.getValue( _xsDataAutoProc.getRefinedCell_gamma(), -1) recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcId = _clientToolsForAutoprocessingWebService.service.storeAutoProc( in0 = iAutoProcProgramId, \ in1 = strSpaceGroup, \ in2 = fRefinedCellA, \ in3 = fRefinedCellB, \ in4 = fRefinedCellC, \ in5 = fRefinedCellAlpha, \ in6 = fRefinedCellBeta, \ in7 = fRefinedCellGamma, \ in8 = recordTimeStamp \ ) self.DEBUG("AutoProcId: %r" % iAutoProcId) return iAutoProcId
def storeOrUpdateScreening(self, _clientToolsForScreeningEDNAWebServiceWsdl, _xsDataISPyBScreening, _iDiffractionPlanId): """Creates an entry in ISPyB for the Screening table""" self.DEBUG("EDPluginISPyBStoreScreeningv1_4.storeScreening") iScreeningId = self.getXSValue(_xsDataISPyBScreening.screeningId) iDataCollectionId = self.getXSValue( _xsDataISPyBScreening.dataCollectionId) iDiffractionPlanId = _iDiffractionPlanId strTimeStamp = DateTime(datetime.datetime.now()) strProgramVersion = self.getXSValue( _xsDataISPyBScreening.programVersion, _iMaxStringLength=45) strComments = self.getXSValue(_xsDataISPyBScreening.comments, _iMaxStringLength=255) strShortComments = self.getXSValue(_xsDataISPyBScreening.shortComments, _iMaxStringLength=20) strXmlSampleInformation = self.getXSValue( _xsDataISPyBScreening.xmlSampleInformation) iScreeningId = _clientToolsForScreeningEDNAWebServiceWsdl.service.storeOrUpdateScreening( iScreeningId, \ iDataCollectionId, \ iDiffractionPlanId, \ strTimeStamp, \ strProgramVersion, \ strComments, \ strShortComments, \ strXmlSampleInformation, \ ) self.DEBUG("ScreeningId: %d" % iScreeningId) return iScreeningId
def storeOrUpdateAutoProcProgramAttachment( self, _clientToolsForAutoprocessingWebService, _xsDataAutoProcProgramAttachment): """Creates an entry in the ISPyB AutoProcProgramAttachment table""" iAutoProcProgramAttachmentId = self.getXSValue( _xsDataAutoProcProgramAttachment.getAutoProcProgramAttachmentId()) strFileType = self.getXSValue( _xsDataAutoProcProgramAttachment.getFileType()) strFileName = self.getXSValue( _xsDataAutoProcProgramAttachment.getFileName()) strFilePath = self.getXSValue( _xsDataAutoProcProgramAttachment.getFilePath()) recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcProgramId = self.iAutoProcProgramId iAutoProcProgramAttachmentId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcProgramAttachment( arg0=iAutoProcProgramAttachmentId, \ fileType=strFileType, \ fileName=strFileName, \ filePath=strFilePath, \ recordTimeStamp=recordTimeStamp, \ autoProcProgramId=iAutoProcProgramId ) self.DEBUG("AutoProcProgramAttachmentId: %r" % iAutoProcProgramAttachmentId) return iAutoProcProgramAttachmentId
def storeOrUpdateAutoProcProgram(self, _clientToolsForAutoprocessingWebService, _xsDataAutoProcProgram): """Creates an entry in the ISPyB AutoProcProgram table""" self.DEBUG( "EDPluginISPyBStoreAutoProcv1_4.storeOrUpdateAutoProcProgram") iAutoProcProgramId = self.getXSValue( _xsDataAutoProcProgram.getAutoProcProgramId()) strProcessingCommandLine = self.getXSValue( _xsDataAutoProcProgram.getProcessingCommandLine()) strProcessingPrograms = self.getXSValue( _xsDataAutoProcProgram.getProcessingPrograms()) strProcessingStatus = self.getXSValue( _xsDataAutoProcProgram.getProcessingStatus(), "SUCCESS") if strProcessingStatus == "true" or strProcessingStatus == "1": strProcessingStatus = "SUCCESS" elif strProcessingStatus == "false" or strProcessingStatus == "0": strProcessingStatus = "FAILED" strProcessingMessage = self.getXSValue( _xsDataAutoProcProgram.getProcessingMessage()) processingStartTime = self.getDateValue( _xsDataAutoProcProgram.getProcessingStartTime(), "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) processingEndTime = self.getDateValue( _xsDataAutoProcProgram.getProcessingEndTime(), "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) strProcessingEnvironment = self.getXSValue( _xsDataAutoProcProgram.getProcessingEnvironment()) recordTimeStamp = self.getDateValue(None, "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) iAutoProcProgramId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcProgram( arg0=iAutoProcProgramId, processingCommandLine=strProcessingCommandLine, processingPrograms=strProcessingPrograms, processingStatus=strProcessingStatus, processingMessage=strProcessingMessage, processingStartTime=processingStartTime, processingEndTime=processingEndTime, processingEnvironment=strProcessingEnvironment, recordTimeStamp=recordTimeStamp) self.DEBUG("AutoProcProgramId: %r" % iAutoProcProgramId) return iAutoProcProgramId
def storeOrUpdateAutoProcIntegration(self, _clientToolsForAutoprocessingWebService, \ _iAutoProcIntegrationId=None, _iDataCollectionId=None): """Creates or updates an entry in the ISPyB AutoProcIntegration table""" recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcIntegrationId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcIntegration( arg0 = _iAutoProcIntegrationId, \ recordTimeStamp= recordTimeStamp, \ dataCollectionId = _iDataCollectionId \ ) self.DEBUG("AutoProcProgramIntegrationId: %r" % iAutoProcIntegrationId) return iAutoProcIntegrationId
def storeOrUpdateAutoProcScalingHasIntId( self, _clientToolsForAutoprocessingWebService): """Creates an entry in the ISPyB storeOrUpdateAutoProcScalingHasIntId table""" iAutoProcIntegrationId = self.iAutoProcIntegrationId iAutoProcScalingId = self.iAutoProcScalingId recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcScalingHasIntId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcScalingHasInt( arg0=None, autoProcIntegrationId=iAutoProcIntegrationId, autoProcScalingId=iAutoProcScalingId, recordTimeStamp=recordTimeStamp) self.DEBUG("AutoProcScalingHasIntId: %r" % iAutoProcScalingHasIntId) return iAutoProcScalingHasIntId
def storeAutoProcScaling(self, _clientToolsForAutoprocessingWebService, _xsDataAutoProcScaling): """Creates an entry in the ISPyB AutoProcScaling table""" iAutoProcId = self.iAutoProcId recordTimeStamp = self.getDateValue( _xsDataAutoProcScaling.getRecordTimeStamp(), "%Y-%m-%d %H:%M:%S", DateTime(datetime.datetime.now())) iAutoProcScalingId = _clientToolsForAutoprocessingWebService.service.storeAutoProcScaling( in0 = iAutoProcId, \ in1 = recordTimeStamp \ ) self.DEBUG("AutoProcScalingId: %r" % iAutoProcScalingId) return iAutoProcScalingId
def storeAutoProcScaling_has_IntId( self, _clientToolsForAutoprocessingWebService): """Creates an entry in the ISPyB storeAutoProcScaling_has_IntId table""" iAutoProcIntegrationId = self.iAutoProcIntegrationId iAutoProcScalingId = self.iAutoProcScalingId recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcScaling_has_intId = _clientToolsForAutoprocessingWebService.service.storeAutoProcScalingHasInt( in0 = iAutoProcIntegrationId, \ in1 = iAutoProcScalingId, \ in2 = recordTimeStamp \ ) self.DEBUG("AutoProcScaling_has_IntId: %r" % iAutoProcScaling_has_intId) return iAutoProcScaling_has_intId
def storeOrUpdateAutoProcStatus(self, _clientToolsForAutoprocessingWebService, \ _xsDataAutoProcStatus, _iAutoProcIntegrationId, _iAutoProcStatusId=None): """Creates or updates an entry in the ISPyB AutoProcIntegration table""" strStep = self.getXSValue(_xsDataAutoProcStatus.getStep()) strStatus = self.getXSValue(_xsDataAutoProcStatus.getStatus()) strComments = self.getXSValue(_xsDataAutoProcStatus.getComments(), _iMaxStringLength=1024) strBltimeStamp = DateTime(datetime.datetime.now()) iAutoProcIntegrationId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcStatus( arg0=_iAutoProcStatusId, \ autoProcIntegrationId=_iAutoProcIntegrationId, \ step=strStep, \ status=strStatus, \ comments=strComments, \ bltimeStamp=strBltimeStamp, \ ) self.DEBUG("AutoProcProgramStatusId: %r" % iAutoProcIntegrationId) return iAutoProcIntegrationId
def xml(self): """ Get xml representation of the object. @return: The root node. @rtype: L{Element} """ root = Element('UsernameToken', ns=wssens) u = Element('Username', ns=wssens) u.setText(self.username) root.append(u) p = Element('Password', ns=wssens) p.setText(self.password) root.append(p) if self.nonce is not None: n = Element('Nonce', ns=wssens) n.setText(self.nonce) root.append(n) if self.created is not None: n = Element('Created', ns=wsuns) n.setText(str(DateTime(self.created))) root.append(n) return root
def storeAutoProcProgramAttachment(self, _clientToolsForAutoprocessingWebService, _xsDataAutoProcProgramAttachment): """Creates an entry in the ISPyB AutoProcProgramAttachment table""" iAutoProcProgramId = self.iAutoProcProgramId strFileType = self.getValue( _xsDataAutoProcProgramAttachment.getFileType(), "") strFileName = self.getValue( _xsDataAutoProcProgramAttachment.getFileName(), "") strFilePath = self.getValue( _xsDataAutoProcProgramAttachment.getFilePath(), "") recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcProgramAttachmentId = _clientToolsForAutoprocessingWebService.service.storeAutoProcProgramAttachment( in0 = strFileType, \ in1 = strFileName, \ in2 = strFilePath, \ in3 = recordTimeStamp, \ in4 = iAutoProcProgramId ) self.DEBUG("AutoProcProgramAttachmentId: %r" % iAutoProcProgramAttachmentId) return iAutoProcProgramAttachmentId
def storeOrUpdateScreeningOutputLattice( self, _clientToolsForScreeningEDNAWebServiceWsdl, _xsDataISPyBScreeningOutputLattice, _iScreeningOutputId): """Creates an entry in ISPyB for the ScreeningOutputLattice table""" self.DEBUG( "EDPluginISPyBStoreScreeningv1_4.storeScreeningOutputLattice") iScreeningOutputLatticeId = self.getXSValue( _xsDataISPyBScreeningOutputLattice.screeningOutputLatticeId) iScreeningOutputId = _iScreeningOutputId strSpaceGroup = self.getXSValue( _xsDataISPyBScreeningOutputLattice.spaceGroup, _iMaxStringLength=45) strPointGroup = self.getXSValue( _xsDataISPyBScreeningOutputLattice.pointGroup, _iMaxStringLength=45) strBravaisLattice = self.getXSValue( _xsDataISPyBScreeningOutputLattice.bravaisLattice, _iMaxStringLength=45) fRawOrientationMatrix_a_x = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_a_x) fRawOrientationMatrix_a_y = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_a_y) fRawOrientationMatrix_a_z = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_a_z) fRawOrientationMatrix_b_x = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_b_x) fRawOrientationMatrix_b_y = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_b_y) fRawOrientationMatrix_b_z = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_b_z) fRawOrientationMatrix_c_x = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_c_x) fRawOrientationMatrix_c_y = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_c_y) fRawOrientationMatrix_c_z = self.getXSValue( _xsDataISPyBScreeningOutputLattice.rawOrientationMatrix_c_z) fUnitCell_a = self.getXSValue( _xsDataISPyBScreeningOutputLattice.unitCell_a) fUnitCell_b = self.getXSValue( _xsDataISPyBScreeningOutputLattice.unitCell_b) fUnitCell_c = self.getXSValue( _xsDataISPyBScreeningOutputLattice.unitCell_c) fUnitCell_alpha = self.getXSValue( _xsDataISPyBScreeningOutputLattice.unitCell_alpha) fUnitCell_beta = self.getXSValue( _xsDataISPyBScreeningOutputLattice.unitCell_beta) fUnitCell_gamma = self.getXSValue( _xsDataISPyBScreeningOutputLattice.unitCell_gamma) strTimeStamp = DateTime(datetime.datetime.now()) bLabelitIndexing = self.getXSValue( _xsDataISPyBScreeningOutputLattice.labelitIndexing, _oDefaultValue=False) iScreeningOutputLatticeId = _clientToolsForScreeningEDNAWebServiceWsdl.service.storeOrUpdateScreeningOutputLattice( iScreeningOutputLatticeId, \ iScreeningOutputId, \ strSpaceGroup, \ strPointGroup, \ strBravaisLattice, \ fRawOrientationMatrix_a_x, \ fRawOrientationMatrix_a_y, \ fRawOrientationMatrix_a_z, \ fRawOrientationMatrix_b_x, \ fRawOrientationMatrix_b_y, \ fRawOrientationMatrix_b_z, \ fRawOrientationMatrix_c_x, \ fRawOrientationMatrix_c_y, \ fRawOrientationMatrix_c_z, \ fUnitCell_a, \ fUnitCell_b, \ fUnitCell_c, \ fUnitCell_alpha, \ fUnitCell_beta, \ fUnitCell_gamma, \ strTimeStamp, \ bLabelitIndexing, \ ) self.DEBUG("ScreeningOutputLatticeId: %d" % iScreeningOutputLatticeId) return iScreeningOutputLatticeId
def testConstructFromString_timezone(self, string, y, M, d, h, m, s, micros, tz_h, tz_m): tzdelta = datetime.timedelta(hours=tz_h, minutes=tz_m) tzinfo = FixedOffsetTimezone(tzdelta) ref = datetime.datetime(y, M, d, h, m, s, micros, tzinfo=tzinfo) assert DateTime(string).value == ref
def testConvertToString(self, input, output): assert str(DateTime(input)) == output
def testConstructFromString(self, string, y, M, d, h, m, s, micros): assert DateTime(string).value == datetime.datetime( y, M, d, h, m, s, micros)
def testConstructFromString_subsecondRounding(self, string, y, M, d, h, m, s, micros): ref = datetime.datetime(y, M, d, h, m, s, micros) assert DateTime(string).value == ref
def process(self, _edObject=None): """ Stores the contents of the AutoProcContainer in ISPyB. """ EDPluginISPyBv1_4.process(self) iDataCollectionId = None self.DEBUG("EDPluginISPyBStoreAutoProcStatusv1_4.process") httpAuthenticatedToolsForAutoprocessingWebService = HttpAuthenticated( username=self.strUserName, password=self.strPassWord) clientToolsForAutoprocessingWebService = Client( self.strToolsForAutoprocessingWebServiceWsdl, transport=httpAuthenticatedToolsForAutoprocessingWebService, cache=None) xsDataInputStoreAutoProcStatus = self.getDataInput() if xsDataInputStoreAutoProcStatus.dataCollectionId is not None: iDataCollectionId = xsDataInputStoreAutoProcStatus.dataCollectionId if xsDataInputStoreAutoProcStatus.autoProcIntegrationId is not None: self.iAutoProcIntegrationId = xsDataInputStoreAutoProcStatus.autoProcIntegrationId if xsDataInputStoreAutoProcStatus.autoProcStatusId is not None: self.iAutoProcStatusId = xsDataInputStoreAutoProcStatus.autoProcStatusId if xsDataInputStoreAutoProcStatus.anomalous is not None: self.bAnomalous = xsDataInputStoreAutoProcStatus.anomalous # If autoProcIntegrationId is not given a dataCollectionId must be present: if (self.iAutoProcIntegrationId is None) and (iDataCollectionId is None): strErrorMessage = "Either data collection id or auto proc integration id must be given as input!" self.error(strErrorMessage) self.addErrorMessage(strErrorMessage) else: if self.iAutoProcIntegrationId is None: # Check if we have AutoProcProgram xsDataAutoProcProgram = xsDataInputStoreAutoProcStatus.AutoProcProgram if xsDataAutoProcProgram is not None: iAutoProcProgramId = self.getXSValue( xsDataAutoProcProgram.getAutoProcProgramId()) strProcessingCommandLine = self.getXSValue( xsDataAutoProcProgram.getProcessingCommandLine()) strProcessingPrograms = self.getXSValue( xsDataAutoProcProgram.getProcessingPrograms()) strProcessingStatus = self.getXSValue( xsDataAutoProcProgram.getProcessingStatus(), "SUCCESS") if strProcessingStatus == "true" or strProcessingStatus == "1": strProcessingStatus = "SUCCESS" elif strProcessingStatus == "false" or strProcessingStatus == "0": strProcessingStatus = "FAILED" strProcessingMessage = self.getXSValue( xsDataAutoProcProgram.getProcessingMessage()) processingStartTime = self.getDateValue( xsDataAutoProcProgram.getProcessingStartTime(), "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) processingEndTime = self.getDateValue( xsDataAutoProcProgram.getProcessingEndTime(), "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) strProcessingEnvironment = self.getXSValue( xsDataAutoProcProgram.getProcessingEnvironment()) recordTimeStamp = self.getDateValue( None, "%a %b %d %H:%M:%S %Y", DateTime(datetime.datetime.now())) self.iAutoProcProgramId = clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcProgram( arg0=iAutoProcProgramId, \ processingCommandLine=strProcessingCommandLine, \ processingPrograms=strProcessingPrograms, \ processingStatus=strProcessingStatus, \ processingMessage=strProcessingMessage, \ processingStartTime=processingStartTime, \ processingEndTime=processingEndTime, \ processingEnvironment=strProcessingEnvironment, \ recordTimeStamp=recordTimeStamp ) else: self.iAutoProcProgramId = None self.DEBUG("iAutoProcProgramId: {0}".format( self.iAutoProcProgramId)) # If no autoProcessingId is given create a dummy entry in the integration table self.iAutoProcIntegrationId = self.storeOrUpdateAutoProcIntegration(clientToolsForAutoprocessingWebService, _iDataCollectionId=iDataCollectionId, _iAutoProcProgramId=self.iAutoProcProgramId, \ _bAnomalous=self.bAnomalous) # Store the AutoProcStatus self.iAutoProcStatusId = self.storeOrUpdateAutoProcStatus(clientToolsForAutoprocessingWebService, \ _xsDataAutoProcStatus=xsDataInputStoreAutoProcStatus.getAutoProcStatus(), \ _iAutoProcIntegrationId=self.iAutoProcIntegrationId, \ _iAutoProcStatusId=self.iAutoProcStatusId)
def testConstructFromDateTime(self): dt = datetime.datetime(2001, 12, 10, 1, 1) assert DateTime(dt).value is dt dt.replace(tzinfo=UtcTimezone()) assert DateTime(dt).value is dt
def setcreated(self, *args, **kwargs): UsernameToken.setcreated(self, *args, **kwargs) if self.created is None: self.created = dt.datetime.utcnow() self.created = str(DateTime(self.created))
def storeDataCollectionProgram(self, _clientToolsForCollectionWebService, _xsDataInputStoreDataCollection): """Creates an entry in the ISPyB DataCollectionProgram table""" self.DEBUG( "EDPluginISPyBStoreDataCollectionv1_4.storeDataCollectionProgram") dataCollection = _xsDataInputStoreDataCollection.getDataCollection() dataCollectionWS3VO = _clientToolsForCollectionWebService.factory.create( 'dataCollectionWS3VO') dataCollectionWS3VO.dataCollectionId = self.getValue( dataCollection.getDataCollectionId(), 0) # integer dataCollectionWS3VO.blSampleId = self.getValue( dataCollection.getBlSampleId(), 0) # integer dataCollectionWS3VO.sessionId = self.getValue( dataCollection.getSessionId()) # integer dataCollectionWS3VO.experimentType = self.getValue( dataCollection.getExperimentType()) # string dataCollectionWS3VO.dataCollectionNumber = self.getValue( dataCollection.getDataCollectionNumber()) # integer dataCollectionWS3VO.startTime = DateTime( self.getValue(dataCollection.getStartDate())) # string dataCollectionWS3VO.endTime = DateTime( self.getValue(dataCollection.getEndDate())) # string dataCollectionWS3VO.runStatus = self.getValue( dataCollection.getRunStatus()) # string dataCollectionWS3VO.rotationAxis = self.getValue( dataCollection.getRotationAxis()) # string dataCollectionWS3VO.phiStart = self.getValue( dataCollection.getPhiStart()) # float dataCollectionWS3VO.kappaStart = self.getValue( dataCollection.getKappaStart()) # float dataCollectionWS3VO.omegaStart = self.getValue( dataCollection.getOmegaStart()) # float dataCollectionWS3VO.axisStart = self.getValue( dataCollection.getAxisStart()) # float dataCollectionWS3VO.axisEnd = self.getValue( dataCollection.getAxisEnd()) # float dataCollectionWS3VO.axisRange = self.getValue( dataCollection.getAxisRange()) # float dataCollectionWS3VO.overlap = self.getValue( dataCollection.getOverlap()) # float dataCollectionWS3VO.numberOfImages = self.getValue( dataCollection.getNumberOfImages()) # integer dataCollectionWS3VO.startImageNumber = self.getValue( dataCollection.getStartImageNumber()) # integer dataCollectionWS3VO.numberOfPasses = self.getValue( dataCollection.getNumberOfPasses()) # integer dataCollectionWS3VO.exposureTime = self.getValue( dataCollection.getExposureTime()) # float dataCollectionWS3VO.imageDirectory = self.getValue( dataCollection.getImageDirectory()) # string dataCollectionWS3VO.imagePrefix = self.getValue( dataCollection.getImagePrefix()) # string dataCollectionWS3VO.imageSuffix = self.getValue( dataCollection.getImageSuffix()) # string dataCollectionWS3VO.fileTemplate = self.getValue( dataCollection.getFileTemplate()) # string dataCollectionWS3VO.wavelength = self.getValue( dataCollection.getWavelength()) # float dataCollectionWS3VO.resolution = self.getValue( dataCollection.getResolution()) # float dataCollectionWS3VO.resolutionAtCorner = self.getValue( dataCollection.getResolutionAtCorner()) # float dataCollectionWS3VO.detectorDistance = self.getValue( dataCollection.getDetectorDistance()) # float dataCollectionWS3VO.detector2theta = self.getValue( dataCollection.getDetector2theta()) # float dataCollectionWS3VO.detectorMode = self.getValue( dataCollection.getDetectorMode()) # string dataCollectionWS3VO.undulatorGap1 = self.getValue( dataCollection.getUndulatorGap1()) # float dataCollectionWS3VO.undulatorGap2 = self.getValue( dataCollection.getUndulatorGap2()) # float dataCollectionWS3VO.undulatorGap3 = self.getValue( dataCollection.getUndulatorGap3()) # float dataCollectionWS3VO.xbeam = self.getValue( dataCollection.getXbeam()) # float dataCollectionWS3VO.ybeam = self.getValue( dataCollection.getYbeam()) # float dataCollectionWS3VO.crystalClass = self.getValue( dataCollection.getCrystalClass()) # string dataCollectionWS3VO.slitGapVertical = self.getValue( dataCollection.getSlitGapVertical()) # float dataCollectionWS3VO.slitGapHorizontal = self.getValue( dataCollection.getSlitGapHorizontal()) # float dataCollectionWS3VO.beamSizeAtSampleX = self.getValue( dataCollection.getBeamSizeAtSampleX()) # float dataCollectionWS3VO.beamSizeAtSampleY = self.getValue( dataCollection.getBeamSizeAtSampleY()) # float dataCollectionWS3VO.transmission = self.getValue( dataCollection.getTransmission()) # float dataCollectionWS3VO.synchrotronMode = self.getValue( dataCollection.getSynchrotronMode()) # string dataCollectionWS3VO.centeringMethod = self.getValue( dataCollection.getCenteringMethod()) # string dataCollectionWS3VO.averageTemperature = self.getValue( dataCollection.getAverageTemperature()) # float dataCollectionWS3VO.comments = self.getValue( dataCollection.getComments()) # string #printableForReport = str(self.getValue(dataCollection.getPrintableForReport())).lower() # boolean if self.getValue(dataCollection.getPrintableForReport()): dataCollectionWS3VO.printableForReport = 1 else: dataCollectionWS3VO.printableForReport = 0 dataCollectionWS3VO.xtalSnapshotFullPath1 = self.getValue( dataCollection.getXtalSnapshotFullPath1()) # string dataCollectionWS3VO.xtalSnapshotFullPath2 = self.getValue( dataCollection.getXtalSnapshotFullPath2()) # string dataCollectionWS3VO.xtalSnapshotFullPath3 = self.getValue( dataCollection.getXtalSnapshotFullPath3()) # string dataCollectionWS3VO.xtalSnapshotFullPath4 = self.getValue( dataCollection.getXtalSnapshotFullPath4()) # string dataCollectionWS3VO.beamShape = self.getValue( dataCollection.getBeamShape()) # string iDataCollectionId = _clientToolsForCollectionWebService.service.storeOrUpdateDataCollection( dataCollection=dataCollectionWS3VO) self.DEBUG("DataCollectionProgramId: %r" % iDataCollectionId) return iDataCollectionId
def __init__(self, date=None): if date is None: date = datetime.datetime.utcnow() DateTime.__init__(self, date)
def storeOrUpdateAutoProcScalingStatistics( self, _clientToolsForAutoprocessingWebService, _xsDataAutoProcScalingStatistics): """Creates an entry in the ISPyB AutoProcScalingStatistics table""" iAutoProcScalingStatisticsId = self.getXSValue( _xsDataAutoProcScalingStatistics.getAutoProcScalingStatisticsId()) strScalingStatisticsType = self.getXSValue( _xsDataAutoProcScalingStatistics.getScalingStatisticsType()) strComments = self.getXSValue( _xsDataAutoProcScalingStatistics.getComments()) fResolutionLimitLow = self.getXSValue( _xsDataAutoProcScalingStatistics.getResolutionLimitLow()) fResolutionLimitHigh = self.getXSValue( _xsDataAutoProcScalingStatistics.getResolutionLimitHigh()) fRmerge = self.getXSValue(_xsDataAutoProcScalingStatistics.getRMerge()) fRmeasWithinIplusIminus = self.getXSValue( _xsDataAutoProcScalingStatistics.getRmeasWithinIplusIminus()) fRmeasAllIplusIminus = self.getXSValue( _xsDataAutoProcScalingStatistics.getRmeasAllIplusIminus()) fRpimWithinIplusIminus = self.getXSValue( _xsDataAutoProcScalingStatistics.getRpimWithinIplusIminus()) fRpimAllIplusIminus = self.getXSValue( _xsDataAutoProcScalingStatistics.getRpimAllIplusIminus()) fFractionalPartialBias = self.getXSValue( _xsDataAutoProcScalingStatistics.getFractionalPartialBias()) iNtotalObservations = self.getXSValue( _xsDataAutoProcScalingStatistics.getNTotalObservations()) iNtotalUniqueObservations = self.getXSValue( _xsDataAutoProcScalingStatistics.getNtotalUniqueObservations()) fMeanIoverSigI = self.getXSValue( _xsDataAutoProcScalingStatistics.getMeanIOverSigI()) fCompleteness = self.getXSValue( _xsDataAutoProcScalingStatistics.getCompleteness()) fMultiplicity = self.getXSValue( _xsDataAutoProcScalingStatistics.getMultiplicity()) fAnomalousCompleteness = self.getXSValue( _xsDataAutoProcScalingStatistics.getAnomalousCompleteness()) fAnomalousMultiplicity = self.getXSValue( _xsDataAutoProcScalingStatistics.getAnomalousMultiplicity()) recordTimeStamp = DateTime(datetime.datetime.now()) bAnomalous = self.getXSValue( _xsDataAutoProcScalingStatistics.getAnomalous(), False) iAutoProcScalingId = self.iAutoProcScalingId fCcHalf = self.getXSValue(_xsDataAutoProcScalingStatistics.getCcHalf()) iAutoProcScalingStatisticsId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcScalingStatistics( arg0=iAutoProcScalingStatisticsId, \ scalingStatisticsType=strScalingStatisticsType, \ comments=strComments, \ resolutionLimitLow=fResolutionLimitLow, \ resolutionLimitHigh=fResolutionLimitHigh, \ rmerge=fRmerge, \ rmeasWithinIplusIminus=fRmeasWithinIplusIminus, \ rmeasAllIplusIminus=fRmeasAllIplusIminus, \ rpimWithinIplusIminus=fRpimWithinIplusIminus, \ rpimAllIplusIminus=fRpimAllIplusIminus, \ fractionalPartialBias=fFractionalPartialBias, \ nTotalObservations=iNtotalObservations, \ nTotalUniqueObservations=iNtotalUniqueObservations, \ meanIoverSigI=fMeanIoverSigI, \ completeness=fCompleteness, \ multiplicity=fMultiplicity, \ anomalousCompleteness=fAnomalousCompleteness, \ anomalousMultiplicity=fAnomalousMultiplicity, \ recordTimeStamp=recordTimeStamp, \ anomalous=bAnomalous, \ autoProcScalingId=iAutoProcScalingId, \ ccHalf=fCcHalf, \ ) self.DEBUG("AutoProcScalingStatisticsId: %r" % iAutoProcScalingStatisticsId) return iAutoProcScalingStatisticsId
def storeOrUpdateAutoProcIntegration( self, _clientToolsForAutoprocessingWebService, _xsDataAutoProcIntegrationContainer): """Creates an entry in the ISPyB AutoProcIntegration table""" xsDataProcIntegration = _xsDataAutoProcIntegrationContainer.getAutoProcIntegration( ) iAutoProcIntegrationId = self.getXSValue( xsDataProcIntegration.getAutoProcIntegrationId()) iAutoProcProgramId = self.iAutoProcProgramId iStartImageNumber = self.getXSValue( xsDataProcIntegration.getStartImageNumber()) iEndImageNumber = self.getXSValue( xsDataProcIntegration.getEndImageNumber()) fRefinedDetectorDistance = self.getXSValue( xsDataProcIntegration.getRefinedDetectorDistance()) fRefinedXbeam = self.getXSValue( xsDataProcIntegration.getRefinedXbeam()) fRefinedYbeam = self.getXSValue( xsDataProcIntegration.getRefinedYbeam()) fRotationAxisX = self.getXSValue( xsDataProcIntegration.getRotationAxisX()) fRotationAxisY = self.getXSValue( xsDataProcIntegration.getRotationAxisY()) fRotationAxisZ = self.getXSValue( xsDataProcIntegration.getRotationAxisZ()) fBeamVectorX = self.getXSValue(xsDataProcIntegration.getBeamVectorX()) fBeamVectorY = self.getXSValue(xsDataProcIntegration.getBeamVectorY()) fBeamVectorZ = self.getXSValue(xsDataProcIntegration.getBeamVectorZ()) fCellA = self.getXSValue(xsDataProcIntegration.getCell_a()) fCellB = self.getXSValue(xsDataProcIntegration.getCell_b()) fCellC = self.getXSValue(xsDataProcIntegration.getCell_c()) fCellAlpha = self.getXSValue(xsDataProcIntegration.getCell_alpha()) fCellBeta = self.getXSValue(xsDataProcIntegration.getCell_beta()) fCellGamma = self.getXSValue(xsDataProcIntegration.getCell_gamma()) bAnomalous = self.getXSValue(xsDataProcIntegration.getAnomalous(), False) iDataCollectionId = _xsDataAutoProcIntegrationContainer.getImage( ).getDataCollectionId() recordTimeStamp = DateTime(datetime.datetime.now()) iAutoProcIntegrationId = _clientToolsForAutoprocessingWebService.service.storeOrUpdateAutoProcIntegration( arg0=iAutoProcIntegrationId, \ autoProcProgramId=iAutoProcProgramId, \ startImageNumber=iStartImageNumber, \ endImageNumber=iEndImageNumber, \ refinedDetectorDistance=fRefinedDetectorDistance, \ refinedXbeam=fRefinedXbeam, \ refinedYbeam=fRefinedYbeam, \ rotationAxisX=fRotationAxisX, \ rotationAxisY=fRotationAxisY, \ rotationAxisZ=fRotationAxisZ, \ beamVectorX=fBeamVectorX, \ beamVectorY=fBeamVectorY, \ beamVectorZ=fBeamVectorZ, \ cellA=fCellA, \ cellB=fCellB, \ cellC=fCellC, \ cellAlpha=fCellAlpha, \ cellBeta=fCellBeta, \ cellGamma=fCellGamma, \ recordTimeStamp=recordTimeStamp, \ anomalous=bAnomalous, \ dataCollectionId=iDataCollectionId \ ) self.DEBUG("AutoProcProgramIntegrationId: %r" % iAutoProcIntegrationId) return iAutoProcIntegrationId