def tearDown(self): os.remove('reasons.db') ma.get_actions_collection().drop() file_name = WorkflowInfo( self.request_base['workflows']).cache_filename('workflow_params') os.remove(file_name)
def update_statuses(self): coll = manageactions.get_actions_collection() self.site_statuses = None self.statuses = { record['workflow']: record['acted'] for record in coll.find() }
def setUp(self): rm.update_reasons(self.reasons1) if ma.get_actions_collection().count() != 0: print 'Test database not empty, abort!!' exit(123) file_name = WorkflowInfo(self.request_base['workflows']).cache_filename('workflow_params') dirname = os.path.dirname(file_name) if not os.path.exists(dirname): os.makedirs(dirname) with open(file_name, 'w') as cache: json.dump({}, cache)
def setUp(self): self.output = {} self.coll = manageactions.get_actions_collection() # Check that test database is empty if self.coll.count() != 0: print('Test database not empty, abort!!') exit(123) now = time.time() # Add the workflows that we want to say exists for acted, workflows in [(0, self.new_workflows), (1, self.old_workflows)]: for wf in workflows: self.coll.insert_one({'workflow': wf, 'acted': acted, 'timestamp': now, 'parameters': {}})
def setUp(self): rm.update_reasons(self.reasons1) if ma.get_actions_collection().count() != 0: print 'Test database not empty, abort!!' exit(123) file_name = WorkflowInfo( self.request_base['workflows']).cache_filename('workflow_params') dirname = os.path.dirname(file_name) if not os.path.exists(dirname): os.makedirs(dirname) with open(file_name, 'w') as cache: json.dump({}, cache)
def tearDown(self): os.remove('reasons.db') ma.get_actions_collection().drop() file_name = WorkflowInfo(self.request_base['workflows']).cache_filename('workflow_params') os.remove(file_name)
""" .. describe:: add_acdc.py A python script that searches the actions database and adds the list of ACDCs to all previous actions :author: Daniel Abercrombie <*****@*****.**> """ from workflowwebtools import workflowinfo from workflowwebtools import manageactions if __name__ == '__main__': manageactions.serverconfig.LOCATION = '.' COLLECTION = manageactions.get_actions_collection() for workflow in manageactions.get_actions(0): print workflow prep_id = workflowinfo.WorkflowInfo(workflow).get_prep_id() COLLECTION.update_one({'workflow': workflow}, {'$set': {'parameters.ACDCs': [wkf for wkf in \ workflowinfo.PrepIDInfo(prep_id).get_workflows() \ if wkf != workflow]} })