Datasets:
Mirror saved portrait workflows and recovery source 1a4de72d
Browse files
scripts/run-priority-catalog.py
CHANGED
|
@@ -8,6 +8,7 @@ import fcntl
|
|
| 8 |
import importlib.util
|
| 9 |
import json
|
| 10 |
import sys
|
|
|
|
| 11 |
from pathlib import Path
|
| 12 |
|
| 13 |
|
|
@@ -18,6 +19,7 @@ def main():
|
|
| 18 |
p.add_argument('--priority-index', type=Path, required=True)
|
| 19 |
p.add_argument('--version', required=True)
|
| 20 |
p.add_argument('--hours', type=float, default=48)
|
|
|
|
| 21 |
p.add_argument('--attempts-per-dog', type=int, default=6, choices=[6])
|
| 22 |
a = p.parse_args()
|
| 23 |
sys.path.insert(0, str(a.runner))
|
|
@@ -37,6 +39,11 @@ def main():
|
|
| 37 |
class PriorityCatalog(base.RosterCatalog):
|
| 38 |
def __init__(self):
|
| 39 |
super().__init__(a.repo, a.version, a.hours, a.attempts_per_dog)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
overlap = set(ids) & set(self.by_id)
|
| 41 |
if overlap:
|
| 42 |
raise ValueError('Priority IDs overlap original catalog')
|
|
|
|
| 8 |
import importlib.util
|
| 9 |
import json
|
| 10 |
import sys
|
| 11 |
+
import time
|
| 12 |
from pathlib import Path
|
| 13 |
|
| 14 |
|
|
|
|
| 19 |
p.add_argument('--priority-index', type=Path, required=True)
|
| 20 |
p.add_argument('--version', required=True)
|
| 21 |
p.add_argument('--hours', type=float, default=48)
|
| 22 |
+
p.add_argument('--deadline', type=float, help='Explicit owner-authorized UTC epoch deadline for a resumed run')
|
| 23 |
p.add_argument('--attempts-per-dog', type=int, default=6, choices=[6])
|
| 24 |
a = p.parse_args()
|
| 25 |
sys.path.insert(0, str(a.runner))
|
|
|
|
| 39 |
class PriorityCatalog(base.RosterCatalog):
|
| 40 |
def __init__(self):
|
| 41 |
super().__init__(a.repo, a.version, a.hours, a.attempts_per_dog)
|
| 42 |
+
if a.deadline is not None:
|
| 43 |
+
if a.deadline > time.time() + 48 * 3600 + 60:
|
| 44 |
+
raise ValueError('Resume deadline exceeds 48 hours')
|
| 45 |
+
self.state['max_hours'] = (a.deadline - self.state['started_at']) / 3600
|
| 46 |
+
self.state['authorized_resume_deadline'] = a.deadline
|
| 47 |
overlap = set(ids) & set(self.by_id)
|
| 48 |
if overlap:
|
| 49 |
raise ValueError('Priority IDs overlap original catalog')
|