mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[mod] add more logging
This commit is contained in:
parent
49a899263d
commit
2e2d97cf8f
1 changed files with 3 additions and 1 deletions
4
run.py
4
run.py
|
@ -413,6 +413,7 @@ async def api_list_job(request):
|
|||
@app.route("/api/job/<job_id:int>", methods=['DELETE'])
|
||||
@require_token()
|
||||
async def api_delete_job(request, job_id):
|
||||
api_logger.info(f"Request to restart job {job_id}")
|
||||
# need to stop a job before deleting it
|
||||
await api_stop_job(request, job_id)
|
||||
|
||||
|
@ -435,7 +436,6 @@ async def api_delete_job(request, job_id):
|
|||
@app.route("/api/job/<job_id:int>/stop", methods=['POST'])
|
||||
async def api_stop_job(request, job_id):
|
||||
# TODO auth or some kind
|
||||
|
||||
job = Job.select().where(Job.id == job_id)
|
||||
|
||||
if job.count() == 0:
|
||||
|
@ -443,6 +443,8 @@ async def api_stop_job(request, job_id):
|
|||
|
||||
job = job[0]
|
||||
|
||||
api_logger.info(f"Request to stop job '{job.name}' [{job.id}]")
|
||||
|
||||
if job.state == "scheduled":
|
||||
api_logger.info(f"Cancel scheduled job '{job.name}' [job.id] on request")
|
||||
job.state = "canceled"
|
||||
|
|
Loading…
Add table
Reference in a new issue