def process_objects(limit=None): """ Process a number of objects from the objectstore and load them to the jobs store """ # default limit to 100 limit = limit or 100 for ds in Datasource.objects.all(): jm = JobsModel(ds.project) try: jm.process_objects(limit) finally: jm.disconnect()
def process_objects(limit=None, project=None): """ Process a number of objects from the objectstore and load them to the jobs store """ # default limit to 100 limit = limit or 100 if project: projects_to_process = [project] else: projects_to_process = Datasource.objects.values_list( 'project', flat=True).distinct() for project in projects_to_process: jm = JobsModel(project) try: jm.process_objects(limit) finally: jm.disconnect()