예제 #1
0
  def helper_add_transfer(self, result):
    if not result:
      gLogger.error("There is no infomation")
      return False

    res = self.transferDB.get_TransferRequest(condDict={
                                                      "id": result.trans_req_id
                                                      })
    if not res["OK"]:
      return False
    req_list = res["Value"]
    if len(req_list) != 1:
      return False
    req =  TransRequestEntryWithID._make(req_list[0])

    # construct the info
    info = {"id": result.id,
            "LFN": result.LFN,
            "srcSE": req.srcSE,
            "dstSE": req.dstSE}
    # Add the Transfer
    worker = gTransferFactory.generate(req.protocol, info)
    self.transferAgent.transfer_worker.append(worker)
    # Change the status
    self.helper_status_update(
        self.transferDB.tables["TransferFileList"],
        result.id,
        {"status":"transfer", 
          "start_time":datetime.datetime.utcnow()})

    return True
예제 #2
0
  def helper_add_transfer(self, result):
    if not result:
      gLogger.error("There is no infomation")
      return False

    res = self.transferDB.get_TransferRequest(condDict={
                                                      "id": result.trans_req_id
                                                      })
    if not res["OK"]:
      return False
    req_list = res["Value"]
    if len(req_list) != 1:
      return False
    req =  TransRequestEntryWithID._make(req_list[0])

    # construct the info
    info = {"id": result.id,
            "LFN": result.LFN,
            "srcSE": req.srcSE,
            "dstSE": req.dstSE}
    # Add the Transfer
    worker = gTransferFactory.generate("DIRACFTS", info)
    self.transferAgent.transfer_worker.append(worker)
    # Change the status
    self.helper_status_update(
        self.transferDB.tables["TransferFileList"],
        result.id,
        {"status":"transfer", 
          "start_time":datetime.datetime.now()})

    return True
예제 #3
0
  def helper_add_transfer(self, result):
    if not result:
      gLogger.error("There is no infomation")
      return False

    res = self.transferDB.get_TransferRequest(condDict={
                                                      "id": result.trans_req_id
                                                      })
    if not res["OK"]:
      return False
    req_list = res["Value"]
    if len(req_list) != 1:
      return False
    req =  TransRequestEntryWithID._make(req_list[0])

    # construct the info
    info = {"id": result.id,
            "LFN": result.LFN,
            "srcSE": req.srcSE,
            "dstSE": req.dstSE,
            "retransfer": -1,
            "error": ""}
    # Add the Transfer
    worker = gTransferFactory.generate(req.protocol, info)
    self.transferAgent.transfer_worker.append(worker)
    # Change the status
    self.helper_status_update(
        self.transferDB.tables["TransferFileList"],
        result.id,
        {"status":"transfer", 
          "start_time":datetime.datetime.utcnow()})
    # Add Accounting:
    d = {}
    d["User"] = req.username
    d["Source"] = req.srcSE
    d["Destination"] = req.dstSE
    d["Protocol"] = req.protocol
    d["FinalStatus"] = "OK"
    d["TransferSize"] = 0 # TODO
    r = self.fileCatalog.getFileSize(result.LFN)
    if r["OK"]:
      if r["Value"]["Successful"]:
        d["TransferSize"] = r["Value"]["Successful"][result.LFN]
    d["TransferTime"] = 1 # 1s 
    d["TransferOK"] = 1
    d["TransferTotal"] = 1
    acct_dt = DataTransfer()
    acct_dt.setValuesFromDict(d)
    acct_dt.setNowAsStartAndEndTime()
    # save it 
    worker.acct_dt = acct_dt

    return True