예제 #1
0
파일: File.py 프로젝트: Teddy22/DIRAC
  def __init__( self, fromDict = None ):
    """c'tor

    :param self: self reference
    :param dict fromDict: property dict
    """
    Record.__init__( self )
    self._parent = None
    self.__data__["FileID"] = 0
    self.__data__["OperationID"] = 0
    self.__data__["Status"] = "Waiting"
    self.__data__["LFN"] = ''
    self.__data__["PFN"] = ''
    self.__data__["ChecksumType"] = ''
    self.__data__["Checksum"] = ''
    self.__data__["GUID"] = ''
    self.__data__["Attempt"] = 0
    self.__data__["Size"] = 0
    self.__data__["Error"] = ''
    self._duration = 0
    fromDict = fromDict if fromDict else {}
    for attrName, attrValue in fromDict.items():
      if attrName not in self.__data__:
        raise AttributeError( "unknown File attribute %s" % str( attrName ) )
      if attrValue:
        setattr( self, attrName, attrValue )
예제 #2
0
파일: File.py 프로젝트: Sbalbp/DIRAC
    def __init__(self, fromDict=None):
        """c'tor

    :param self: self reference
    :param dict fromDict: property dict
    """
        Record.__init__(self)
        self._parent = None
        self.__data__["FileID"] = 0
        self.__data__["OperationID"] = 0
        self.__data__["Status"] = "Waiting"
        self.__data__["LFN"] = ''
        self.__data__["PFN"] = ''
        self.__data__["ChecksumType"] = ''
        self.__data__["Checksum"] = ''
        self.__data__["GUID"] = ''
        self.__data__["Attempt"] = 0
        self.__data__["Size"] = 0
        self.__data__["Error"] = ''
        self._duration = 0
        fromDict = fromDict if fromDict else {}
        for attrName, attrValue in fromDict.items():
            if attrName not in self.__data__:
                raise AttributeError("unknown File attribute %s" %
                                     str(attrName))
            if attrValue:
                setattr(self, attrName, attrValue)
예제 #3
0
파일: FTSJob.py 프로젝트: graciani/DIRAC
    def __init__(self, fromDict=None):
        """c'tor

    :param self: self reference
    :param dict fromDict: data dict
    """
        Record.__init__(self)
        now = datetime.datetime.utcnow().replace(microsecond=0)
        self.__data__["CreationTime"] = now
        self.__data__["SubmitTime"] = now
        self.__data__["LastUpdate"] = now
        self.__data__["Status"] = "Submitted"
        self.__data__["Completeness"] = 0
        self.__data__["FTSJobID"] = 0
        self.__files__ = TypedList(allowedTypes=FTSFile)

        self._log = gLogger.getSubLogger("FTSJob-%s" % self.FTSJobID, True)

        fromDict = fromDict if fromDict else {}
        for ftsFileDict in fromDict.get("FTSFiles", []):
            self += FTSFile(ftsFileDict)
        if "FTSFiles" in fromDict: del fromDict["FTSFiles"]
        for key, value in fromDict.items():
            if key not in self.__data__:
                raise AttributeError("Unknown FTSJob attribute '%s'" % key)
            if value:
                setattr(self, key, value)
예제 #4
0
  def __init__( self, fromDict = None ):
    """c'tor

    :param self: self reference
    :param dict fromDict: data dict
    """
    Record.__init__( self )
    now = datetime.datetime.utcnow().replace( microsecond = 0 )
    self.__data__["CreationTime"] = now
    self.__data__["SubmitTime"] = now
    self.__data__["LastUpdate"] = now
    self.__data__["Status"] = "Submitted"
    self.__data__["Completeness"] = 0
    self.__data__["FTSJobID"] = 0
    self.__files__ = TypedList( allowedTypes = FTSFile )

    self._log = gLogger.getSubLogger( "FTSJob-%s" % self.FTSJobID , True )

    fromDict = fromDict if fromDict else {}
    for ftsFileDict in fromDict.get( "FTSFiles", [] ):
      self +=FTSFile( ftsFileDict )
    if "FTSFiles" in fromDict: del fromDict["FTSFiles"]
    for key, value in fromDict.items():
      if key not in self.__data__:
        raise AttributeError( "Unknown FTSJob attribute '%s'" % key )
      if value:
        setattr( self, key, value )
예제 #5
0
파일: Request.py 프로젝트: afalabel/DIRAC
  def __init__( self, fromDict = None ):
    """c'tor

    :param self: self reference
    """
    Record.__init__( self )
    self.__waiting = None

    now = datetime.datetime.utcnow().replace( microsecond = 0 )
    self.__data__["CreationTime"] = now
    self.__data__["SubmitTime"] = now
    self.__data__["LastUpdate"] = now
    self.__data__["Status"] = "Done"
    self.__data__["JobID"] = 0
    self.__data__["RequestID"] = 0

    proxyInfo = getProxyInfo()
    if proxyInfo["OK"]:
      proxyInfo = proxyInfo["Value"]
      if proxyInfo["validGroup"] and proxyInfo["validDN"]:
        self.OwnerDN = proxyInfo["identity"]
        self.OwnerGroup = proxyInfo["group"]

    self.__dirty = []
    self.__operations__ = TypedList( allowedTypes = Operation )

    fromDict = fromDict if fromDict else {}

    self.__dirty = fromDict.get( "__dirty", [] )
    if "__dirty" in fromDict:
      del fromDict["__dirty"]

    for opDict in fromDict.get( "Operations", [] ):
      self +=Operation( opDict )
    if "Operations" in fromDict:
      del fromDict["Operations"]

    for key, value in fromDict.items():
      if key not in self.__data__:
        raise AttributeError( "Unknown Request attribute '%s'" % key )
      if value:
        setattr( self, key, value )
    self._notify()
예제 #6
0
  def __init__( self, fromDict = None ):
    """c'tor

    :param self: self reference
    :param dict fromDict: data dict
    """
    _parent = None
    Record.__init__( self )
    self._parent = None
    self.__data__["Status"] = "Waiting"
    self.__data__["Attempt"] = 0
    now = datetime.datetime.utcnow().replace( microsecond = 0 )
    self.__data__["CreationTime"] = now
    self.__data__["LastUpdate"] = now
    fromDict = fromDict if fromDict else {}
    for attrName, attrValue in fromDict.items():
      if attrName not in self.__data__:
        raise AttributeError( "unknown FTSFile attribute %s" % str( attrName ) )
      setattr( self, attrName, attrValue )
예제 #7
0
파일: Request.py 프로젝트: sposs/DIRAC
  def __init__( self, fromDict = None ):
    """c'tor

    :param self: self reference
    """
    Record.__init__( self )
    self.__waiting = None

    now = datetime.datetime.utcnow().replace( microsecond = 0 )
    self.__data__["CreationTime"] = now
    self.__data__["SubmitTime"] = now
    self.__data__["LastUpdate"] = now
    self.__data__["Status"] = "Done"
    self.__data__["JobID"] = 0
    self.__data__["RequestID"] = 0

    proxyInfo = getProxyInfo()
    if proxyInfo["OK"]:
      proxyInfo = proxyInfo["Value"]
      if proxyInfo["validGroup"] and proxyInfo["validDN"]:
        self.OwnerDN = proxyInfo["identity"]
        self.OwnerGroup = proxyInfo["group"]

    self.__dirty = []
    self.__operations__ = TypedList( allowedTypes = Operation )

    fromDict = fromDict if fromDict else {}

    self.__dirty = fromDict.get( "__dirty", [] )
    if "__dirty" in fromDict:
      del fromDict["__dirty"]

    for opDict in fromDict.get( "Operations", [] ):
      self +=Operation( opDict )
    if "Operations" in fromDict:
      del fromDict["Operations"]

    for key, value in fromDict.items():
      if key not in self.__data__:
        raise AttributeError( "Unknown Request attribute '%s'" % key )
      if value:
        setattr( self, key, value )
    self._notify()
예제 #8
0
파일: FTSFile.py 프로젝트: sposs/DIRAC
    def __init__(self, fromDict=None):
        """c'tor

    :param self: self reference
    :param dict fromDict: data dict
    """
        _parent = None
        Record.__init__(self)
        self._parent = None
        self.__data__["Status"] = "Waiting"
        self.__data__["Attempt"] = 0
        now = datetime.datetime.utcnow().replace(microsecond=0)
        self.__data__["CreationTime"] = now
        self.__data__["LastUpdate"] = now
        fromDict = fromDict if fromDict else {}
        for attrName, attrValue in fromDict.items():
            if attrName not in self.__data__:
                raise AttributeError("unknown FTSFile attribute %s" %
                                     str(attrName))
            setattr(self, attrName, attrValue)
예제 #9
0
파일: Operation.py 프로젝트: ptakha/DIRAC-1
    def __init__(self, fromDict=None):
        """ c'tor

    :param self: self reference
    :param dict fromDict: attributes dictionary
    """
        Record.__init__(self)
        self._parent = None
        # # sub-request attributes
        # self.__data__ = dict.fromkeys( self.tableDesc()["Fields"].keys(), None )
        now = datetime.datetime.utcnow().replace(microsecond=0)
        self.__data__["SubmitTime"] = now
        self.__data__["LastUpdate"] = now
        self.__data__["CreationTime"] = now
        self.__data__["OperationID"] = 0
        self.__data__["RequestID"] = 0
        self.__data__["Status"] = "Queued"

        # # operation files
        self.__files__ = TypedList(allowedTypes=File)
        # # dirty fileIDs
        self.__dirty = []

        # # init from dict
        fromDict = fromDict if fromDict else {}

        self.__dirty = fromDict.get("__dirty", [])
        if "__dirty" in fromDict:
            del fromDict["__dirty"]

        for fileDict in fromDict.get("Files", []):
            self.addFile(File(fileDict))
        if "Files" in fromDict:
            del fromDict["Files"]

        for key, value in fromDict.items():
            if key not in self.__data__:
                raise AttributeError("Unknown Operation attribute '%s'" % key)
            if key != "Order" and value:
                setattr(self, key, value)
예제 #10
0
파일: Operation.py 프로젝트: afalabel/DIRAC
  def __init__( self, fromDict = None ):
    """ c'tor

    :param self: self reference
    :param dict fromDict: attributes dictionary
    """
    Record.__init__( self )
    self._parent = None
    # # sub-request attributes
    # self.__data__ = dict.fromkeys( self.tableDesc()["Fields"].keys(), None )
    now = datetime.datetime.utcnow().replace( microsecond = 0 )
    self.__data__["SubmitTime"] = now
    self.__data__["LastUpdate"] = now
    self.__data__["CreationTime"] = now
    self.__data__["OperationID"] = 0
    self.__data__["RequestID"] = 0
    self.__data__["Status"] = "Queued"

    # # operation files
    self.__files__ = TypedList( allowedTypes = File )
    # # dirty fileIDs
    self.__dirty = []

    # # init from dict
    fromDict = fromDict if fromDict else {}

    self.__dirty = fromDict.get( "__dirty", [] )
    if "__dirty" in fromDict:
      del fromDict["__dirty"]

    for fileDict in fromDict.get( "Files", [] ):
      self.addFile( File( fileDict ) )
    if "Files" in fromDict:
      del fromDict["Files"]

    for key, value in fromDict.items():
      if key not in self.__data__:
        raise AttributeError( "Unknown Operation attribute '%s'" % key )
      if key != "Order" and value:
        setattr( self, key, value )