Example #1
0
    def setUp(self):
        super(WorkflowTestCase, self).setUp()

        self.patch(db, '_DBAPI', {})
        self.dbapi = db.dbapi(self.CONF)

        self.torrent = self.dbapi.save_torrent(
            models.Torrent(torrent_id=None,
                           name='fake1.torrent'))
Example #2
0
    def setUp(self):
        super(TorrentLoaderTest, self).setUp()

        self.CONF.set_override('torrent_path',
                               torrent_path,
                               group='torrent')

        self.CONF.set_override('media_paths',
                               [torrent_path],
                               group='torrent')

        self.CONF.set_override('incomplete_path',
                               torrent_path,
                               group='torrent')

        self.patch(db, '_DBAPI', {})
        self.dbapi = db.dbapi(self.CONF)
Example #3
0
    def setUp(self):
        super(FlowTestCase, self).setUp()

        self.patch(db, '_DBAPI', {})
        self.dbapi = db.dbapi(self.CONF)

        self.torrent = self.dbapi.save_torrent(
            models.Torrent(torrent_id=None,
                           name='fake1.torrent'))

        self.CONF.set_override('prepare',
                               ['filecopy', 'fileunrar'],
                               group='process')

        self.CONF.set_override('activate',
                               ['filesync'],
                               group='process')

        self.CONF.set_override('complete',
                               ['filedelete'],
                               group='process')
Example #4
0
def start():
    """The primary entry point for the process"""
    dbapi = db.dbapi()
    mgr = manager.TaskManager()
    flows = []

    try:
        while True:

            # if no flows which should happen on initial run
            # or after processing all the previously found
            # torrents.
            if not flows:
                # attempt to load the torrents and generate
                # workflows for each active torrent
                flows = _get_work(dbapi)
                # if still no torrents break out
                if not flows:
                    break

            # for each flow get the next list of tasks to process
            for wf in flows:
                mgr.add_tasks(list(wf.next_tasks()))

            # now execute the via TaskManager
            results = mgr.run()
            for item in results:
                LOG.debug("saving media: %s", item)
                # the results should be the updated media so save it
                dbapi.save_media(item)

            # for each flow execute it, if wf is done then remove it
            # from the list.
            for wf in flows:
                if wf.run():
                    flows.remove(wf)
    finally:
        mgr.shutdown()
        dbapi.clean_up()
Example #5
0
    def setUp(self):
        super(DbMaintenanceTest, self).setUp()

        # initialize the database and schema details.
        db.dbapi(self.CONF)
Example #6
0
    def setUp(self):
        super(ApiDBTestCase, self).setUp()

        self.patch(db, '_DBAPI', {})
        self.dbapi = db.dbapi(self.CONF)