-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1093 from linea-it/run_prediction_by_class
Submit predictions by class and subclass via command line
- Loading branch information
Showing
4 changed files
with
304 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
backend/tno/management/commands/prediction_job_by_class.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import datetime | ||
|
||
from django.core.management.base import BaseCommand | ||
from tno.predict_job import run_prediction_by_class | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Creates prediction jobs for asteroids that have had their current orbit updated in the MPC." | ||
|
||
def add_arguments(self, parser): | ||
""" | ||
Adds command-line arguments to the parser for the run_prediction_by_class function. | ||
Args: | ||
parser (argparse.ArgumentParser): The argument parser instance. | ||
Returns: | ||
None | ||
""" | ||
parser.add_argument( | ||
"--base_dynclass", | ||
type=str, | ||
default=None, | ||
help="Specify the base dynamical class of asteroids.", | ||
) | ||
parser.add_argument( | ||
"--sub_class", | ||
type=str, | ||
default=None, | ||
help="Specify the sub dynamical class of asteroids.", | ||
) | ||
parser.add_argument( | ||
"--start_date", | ||
type=str, | ||
default=None, | ||
help="Specify the start date for the prediction range (YYYY-MM-DD).", | ||
) | ||
parser.add_argument( | ||
"--end_date", | ||
type=str, | ||
default=None, | ||
help="Specify the end date for the prediction range (YYYY-MM-DD).", | ||
) | ||
parser.add_argument( | ||
"--chunk_size", | ||
type=int, | ||
default=2000, | ||
help="Specify the number of asteroids per prediction job chunk.", | ||
) | ||
parser.add_argument( | ||
"--debug", | ||
action="store_true", | ||
default=False, | ||
help="Enable debug mode for detailed output.", | ||
) | ||
|
||
def handle(self, *args, **options): | ||
run_prediction_by_class( | ||
base_dynclass=options.get("base_dynclass"), | ||
sub_class=options.get("sub_class"), | ||
start_date=options.get("start_date"), | ||
end_date=options.get("end_date"), | ||
chunk_size=options.get("chunk_size", 2000), | ||
debug=options.get("debug", False), | ||
) |
Oops, something went wrong.