def job_abort(self): if len(self.args) >= 2: job_or_source_id_or_name = unicode(self.args[1]) else: print("Please provide a job id or source name/id") sys.exit(1) print(utils.abort_job(job_or_source_id_or_name))
def job_abort(ctx, id): """Marks a job as "Aborted" so that the source can be restarted afresh. It ensures that the job's harvest objects status are also marked finished. You should ensure that neither the job nor its objects are currently in the gather/fetch queues. """ flask_app = ctx.meta["flask_app"] with flask_app.test_request_context(): try: result = utils.abort_job(id) except tk.ObjectNotFound as e: tk.error_shout(u"Job not found.") ctx.abort() click.echo(result)