Disable auto-scheduling in testing mode (fixes #12)
parent
07c6e0c352
commit
b818f4e1af
|
@ -125,6 +125,11 @@ def main():
|
||||||
"than this limit [default: 0.0, maximum: 1.0]",
|
"than this limit [default: 0.0, maximum: 1.0]",
|
||||||
type=float,
|
type=float,
|
||||||
default=0.)
|
default=0.)
|
||||||
|
parser.add_argument("-T",
|
||||||
|
"--allow-testing",
|
||||||
|
help="Allow scheduling on stations which are in testing mode [default: False]",
|
||||||
|
action="store_true")
|
||||||
|
parser.set_defaults(allow_testing=False)
|
||||||
parser.add_argument("-l",
|
parser.add_argument("-l",
|
||||||
"--log-level",
|
"--log-level",
|
||||||
default="INFO",
|
default="INFO",
|
||||||
|
@ -175,7 +180,7 @@ def main():
|
||||||
tmax = tnow + timedelta(hours=length_hours)
|
tmax = tnow + timedelta(hours=length_hours)
|
||||||
|
|
||||||
# Get ground station information
|
# Get ground station information
|
||||||
ground_station = get_groundstation_info(ground_station_id)
|
ground_station = get_groundstation_info(ground_station_id, args.allow_testing)
|
||||||
if not ground_station:
|
if not ground_station:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
12
utils.py
12
utils.py
|
@ -335,7 +335,7 @@ def get_priority_passes(passes, priorities, favorite_transmitters, only_priority
|
||||||
normal.append(satpass)
|
normal.append(satpass)
|
||||||
return (priority, normal)
|
return (priority, normal)
|
||||||
|
|
||||||
def get_groundstation_info(ground_station_id):
|
def get_groundstation_info(ground_station_id, allow_testing):
|
||||||
|
|
||||||
logging.info("Requesting information for ground station %d" % ground_station_id)
|
logging.info("Requesting information for ground station %d" % ground_station_id)
|
||||||
|
|
||||||
|
@ -353,11 +353,15 @@ def get_groundstation_info(ground_station_id):
|
||||||
logging.info('Ground station information retrieved!')
|
logging.info('Ground station information retrieved!')
|
||||||
station = selected_stations[0]
|
station = selected_stations[0]
|
||||||
|
|
||||||
if station['status'] == 'Online' or station['status'] == 'Testing':
|
if station['status'] == 'Online' or (station['status'] == 'Testing' and allow_testing):
|
||||||
return station
|
return station
|
||||||
else:
|
else:
|
||||||
logging.info("Ground station {} neither in 'online' nor in 'testing' mode, "
|
if station['status'] == 'Testing' and not allow_testing:
|
||||||
"can't schedule!".format(ground_station_id))
|
logging.info("Ground station {} is in testing mode but auto-scheduling is not "
|
||||||
|
"allowed. Use -T command line argument to enable scheduling.".format(ground_station_id))
|
||||||
|
else:
|
||||||
|
logging.info("Ground station {} neither in 'online' nor in 'testing' mode, "
|
||||||
|
"can't schedule!".format(ground_station_id))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue