Skip to content

Commit

Permalink
Revert "fix flake8"
Browse files Browse the repository at this point in the history
This reverts commit 3190032.
  • Loading branch information
dsschult committed Oct 15, 2024
1 parent 3190032 commit 30b6a73
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion iceprod/rest/handlers/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import json

from jsonschema.exceptions import ValidationError
from jsonschema.exceptions import ValidationError
import tornado.web

from ..base_handler import APIBase
Expand Down
21 changes: 18 additions & 3 deletions iceprod/scheduled_tasks/non_active_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ async def run(rest_client, debug=False):
"""
try:
datasets = await rest_client.request('GET', '/dataset_summaries/status')
dataset_ids = datasets.get('processing', [])

dataset_ids = []
if 'processing' in datasets:
dataset_ids.extend(datasets['processing'])
if 'truncated' in datasets:
dataset_ids.extend(datasets['truncated'])
pilots = await rest_client.request('GET', '/pilots', {'keys': 'pilot_id|tasks'})
task_ids_in_pilots = set()
for p in pilots.values():
if 'tasks' in p and p['tasks']:
task_ids_in_pilots.update(p['tasks'])
dataset_tasks = {}
for dataset_id in dataset_ids:
dataset_tasks[dataset_id] = await rest_client.request('GET', '/datasets/{}/task_summaries/status'.format(dataset_id))

async def reset(dataset_id, task_id):
args = {'status': 'waiting'}
args = {'status':'reset'}
await rest_client.request('PUT', f'/datasets/{dataset_id}/tasks/{task_id}/status', args)
data = {
'name': 'stdlog',
Expand All @@ -47,6 +55,13 @@ async def reset(dataset_id, task_id):
data.update({'name':'stderr', 'data': ''})
await rest_client.request('POST', '/logs', data)

async def update_pilot(pilot_id, tasks):
args = {'tasks': tasks}
await rest_client.request('PATCH', '/pilots/{}'.format(pilot_id), args)

async def delete_pilot(pilot_id):
await rest_client.request('DELETE', '/pilots/{}'.format(pilot_id))

awaitables = set()
reset_pilots = set()
for dataset_id in dataset_ids:
Expand Down

0 comments on commit 30b6a73

Please sign in to comment.