def __init__(self, mutex, event_list, config, database='processflow.db'):
        """
        Parameters:
            mutex (theading.Lock) the mutext for accessing the database
            database (str): the path to where to create the sqlite database file
            config (dict): the global configuration dict
        """
        self._mutex = mutex
        self._event_list = event_list
        self._db_path = database
        self._config = config

        if os.path.exists(database):
            os.remove(database)

        self._mutex.acquire()
        DataFile._meta.database.init(database)
        if DataFile.table_exists():
            DataFile.drop_table()

        DataFile.create_table()
        if self._mutex.locked():
            self._mutex.release()

        self.thread_list = list()
        self.kill_event = threading.Event()
Ejemplo n.º 2
0
    def __init__(self, database, types, sta=False, **kwargs):
        """
        Parameters:
            mutex (theading.Lock) the mutext for accessing the database
            sta (bool) is this run short term archived or not (1) yes (0) no
            types (list(str)): A list of strings of datatypes
            database (str): the path to where to create the sqlite database file
            remote_endpoint (str): the Globus UUID for the remote endpoint
            remote_path (str): the base directory to search for this runs model output
            local_endpoint (str): The Globus UUID for the local endpoint
            local_path (str): the local project path
        """
        self.mutex = kwargs['mutex']
        self.sta = sta
        self.updated_rest = False
        self.types = types if isinstance(types, list) else [types]
        self.active_transfers = 0
        self.db_path = database
        self.mutex.acquire()
        DataFile._meta.database.init(database)
        if DataFile.table_exists():
            DataFile.drop_table()
        DataFile.create_table()
        if self.mutex.locked():
            self.mutex.release()
        self.remote_endpoint = kwargs.get('remote_endpoint')
        self.local_path = kwargs.get('local_path')
        self.local_endpoint = kwargs.get('local_endpoint')
        self.start_year = 0

        head, tail = os.path.split(kwargs.get('remote_path'))
        if not self.sta:
            if tail != 'run':
                self.remote_path = os.path.join(kwargs.get('remote_path'),
                                                'run')
            else:
                self.remote_path = kwargs.get('remote_path')
        else:
            if tail == 'run':
                self.remote_path = head
            else:
                self.remote_path = kwargs.get('remote_path')
Ejemplo n.º 3
0
    def __init__(self, event_list, config, database='processflow.db'):
        """
        Parameters:
            database (str): the path to where to create the sqlite database file
            config (dict): the global configuration dict
        """
        self._event_list = event_list
        self._db_path = database
        self._config = config

        if os.path.exists(database):
            os.remove(database)

        DataFile._meta.database.init(database)
        if DataFile.table_exists():
            DataFile.drop_table()

        DataFile.create_table()

        self.thread_list = list()
        self.kill_event = threading.Event()