Development
This commit is contained in:
parent
563d82daf3
commit
70ccfe2c29
48 changed files with 549 additions and 578 deletions
|
|
@ -1,28 +1,25 @@
|
|||
from flask import Blueprint, request, jsonify
|
||||
from auth import require_level
|
||||
from config_utils import (
|
||||
_load_done_set, _is_locked, _lock_mtime,
|
||||
_seconds_until_next_run, _entry_ts_from_queue,
|
||||
)
|
||||
import auth
|
||||
import config_utils
|
||||
|
||||
bp = Blueprint('api_apply_health', __name__)
|
||||
|
||||
|
||||
@bp.route('/api/apply-health')
|
||||
@require_level('viewer')
|
||||
@auth.require_level('viewer')
|
||||
def apply_health():
|
||||
entry_uuid = request.args.get('uuid', '')
|
||||
if not entry_uuid:
|
||||
return jsonify({'status': 'unknown'})
|
||||
|
||||
if entry_uuid in _load_done_set():
|
||||
if entry_uuid in config_utils._load_done_set():
|
||||
return jsonify({'status': 'complete'})
|
||||
|
||||
if _is_locked():
|
||||
mtime = _lock_mtime()
|
||||
entry_ts = _entry_ts_from_queue(entry_uuid)
|
||||
if config_utils._is_locked():
|
||||
mtime = config_utils._lock_mtime()
|
||||
entry_ts = config_utils._entry_ts_from_queue(entry_uuid)
|
||||
if mtime and entry_ts is not None and entry_ts < mtime:
|
||||
return jsonify({'status': 'running'})
|
||||
return jsonify({'status': 'pending', 'next_in': None})
|
||||
|
||||
return jsonify({'status': 'pending', 'next_in': _seconds_until_next_run()})
|
||||
return jsonify({'status': 'pending', 'next_in': config_utils._seconds_until_next_run()})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue