def test_skip_running(self): """Verify that if running, it won't get returned again""" self._login_admin() res = self._upload() eq_(res.status, "302 Found", msg='Import status is 302 redirect by home, ' + res.status) # now verify that we've got our record imp = ImportQueueMgr.get_ready() imp = imp[0] imp.status=2 DBSession.flush() imp = ImportQueueMgr.get_ready() ok_(not imp, 'We should get no results back')
def test_skip_running(self): """Verify that if running, it won't get returned again""" self._login_admin() res = self._upload() eq_(res.status, "302 Found", msg='Import status is 302 redirect by home, ' + res.status) # now verify that we've got our record imp = ImportQueueMgr.get_ready() imp = imp[0] imp.status = 2 DBSession.flush() imp = ImportQueueMgr.get_ready() ok_(not imp, 'We should get no results back')
def importer_process(): """Check for new imports that need to be scheduled to run""" initialize_sql(ini) imports = ImportQueueMgr.get_ready(limit=1) for i in imports: # Log that we've scheduled it logger = importer_process.get_logger() logger.info("IMPORT: SCHEDULED for {username}.".format(**dict(i))) # We need to mark that it's running to prevent it getting picked up # again. trans = transaction.begin() i.mark_running() trans.commit() celery.task.subtask(importer_process_worker, args=(i.id,)).delay()
def importer_process(): """Check for new imports that need to be scheduled to run""" initialize_sql(ini) imports = ImportQueueMgr.get_ready(limit=1) for i in imports: # Log that we've scheduled it logger = importer_process.get_logger() logger.info("IMPORT: SCHEDULED for {username}.".format(**dict(i))) # We need to mark that it's running to prevent it getting picked up # again. trans = transaction.begin() i.mark_running() trans.commit() celery.task.subtask(importer_process_worker, args=(i.id, )).delay()
def test_import_upload(self): """After we upload a file, we should have an importer queue.""" self._login_admin() # verify we get the form res = self.app.get('/admin/import') ok_('<form' in res.body, 'Should have a form in the body for submitting the upload') res = self._upload() eq_(res.status, "302 Found", msg='Import status is 302 redirect by home, ' + res.status) # now verify that we've got our record imp = ImportQueueMgr.get_ready() imp = imp[0] ok_(imp, 'We should have a record') ok_(imp.file_path.endswith('admin.delicious.html')) eq_(imp.status, 0, 'start out as default status of 0')