Disable auto-scheduling in testing mode (fixes #12)

merge-requests/41/head
cgbsat 2019-08-06 15:05:38 +00:00
parent 07c6e0c352
commit b818f4e1af
2 changed files with 14 additions and 5 deletions

View File

@ -125,6 +125,11 @@ def main():
"than this limit [default: 0.0, maximum: 1.0]",
type=float,
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",
"--log-level",
default="INFO",
@ -175,7 +180,7 @@ def main():
tmax = tnow + timedelta(hours=length_hours)
# 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:
sys.exit()

View File

@ -335,7 +335,7 @@ def get_priority_passes(passes, priorities, favorite_transmitters, only_priority
normal.append(satpass)
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)
@ -353,11 +353,15 @@ def get_groundstation_info(ground_station_id):
logging.info('Ground station information retrieved!')
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
else:
logging.info("Ground station {} neither in 'online' nor in 'testing' mode, "
"can't schedule!".format(ground_station_id))
if station['status'] == 'Testing' and not allow_testing:
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 {}