def __init__(self, task_db=None, iterator=None, job_db=None, config=None): if task_db is None: task_db = simcity.get_task_database() super(ExecuteActor, self).__init__(task_db, iterator=iterator) if job_db is None: job_db = simcity.get_job_database() self.job_db = job_db if config is None: config = simcity.get_config() self.config = config.section("Execution")
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ''' Delete all documents from given view ''' from __future__ import print_function import simcity import argparse if __name__ == '__main__': task_views = ['todo', 'done', 'locked'] job_views = [ 'pending_jobs', 'active_jobs', 'finished_jobs', 'archived_jobs'] parser = argparse.ArgumentParser(description="Remove all tasks in a view") parser.add_argument('view', choices=task_views + job_views, help="View to remove documents from") parser.add_argument('-c', '--config', help="configuration file", default=None) args = parser.parse_args() simcity.init(config=args.config) if args.view in task_views: db = simcity.get_task_database() else: db = simcity.get_job_database() is_deleted = db.delete_from_view(args.view) print("Deleted %d out of %d tasks from view %s" % (sum(is_deleted), len(is_deleted), args.view))