Bases: KPFFunction
Script to run a list of OBs as scheduled cals.
Source code in kpf/scripts/RunOBs.py
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 | class RunOBs(KPFFunction):
'''Script to run a list of OBs as scheduled cals.
'''
@classmethod
def pre_condition(cls, args):
pass
@classmethod
def perform(cls, args):
for file in args.get('files'):
file = Path(file)
try:
OB = ObservingBlock(file)
except Exception as e:
print(f'ERROR: Unable to parse OB from {file}')
print(e)
break
if OB.validate():
RunOB.execute({'waitforscript': True,
'scheduled': True},
OB=OB)
else:
print(f'ERROR: OB from {file} was invalid, not executing OB')
@classmethod
def post_condition(cls, args):
pass
@classmethod
def add_cmdline_args(cls, parser):
parser.add_argument('files', nargs='*',
help='The OB files to run')
return super().add_cmdline_args(parser)
|