def initializeDatasetHandler(serviceInfo): """ initialize handler """ gLogger.info("Initialize Dataset Handler.") from BESDIRAC.TransferSystem.DB.TransferDB import TransferDB global gTransferDB gTransferDB = TransferDB() return S_OK()
def initialize(self): self.count = 0 self.MAX_TRANSFER = self.am_getOption("MAX_TRANSFER", 2) gLogger.info("MAX_TRANSFER: ", self.MAX_TRANSFER) self.transfer_worker = [] global gTransferDB from BESDIRAC.TransferSystem.DB.TransferDB import TransferDB from BESDIRAC.TransferSystem.Agent.helper import helper_TransferAgent gTransferDB = TransferDB() self.helper = helper_TransferAgent(self, gTransferDB) return S_OK()
updateDict = toUpdate, condDict = {"id":id}, ) print res def helper_error_report(self, worker, reason): self.helper_status_update(self.transferDB.tables["TransferFileList"], worker.info["id"], {"error": reason}) if __name__ == "__main__": from DIRAC.Core.Base import Script Script.parseCommandLine( ignoreErrors = True ) from BESDIRAC.TransferSystem.DB.TransferDB import TransferDB gTransferDB = TransferDB() transferAgent = gTransferDB transferAgent.transfer_worker = [] helper = helper_TransferAgent(transferAgent, gTransferDB) entry = helper.helper_get_new_File() print helper.helper_get_new_request_entry() if entry: print helper.helper_status_update( table = "TransferFileList", id = entry.id, toStatus = {"status":"transfer"}) print helper.helper_check_request() print helper.helper_add_transfer(entry) print transferAgent.transfer_worker