-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix #99. Including improve CLI itself
- Loading branch information
Showing
2 changed files
with
40 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
import sys | ||
from pdr_backend.predictoor.approach1.main import main as main1 | ||
from pdr_backend.predictoor.approach2.main import main as main2 | ||
|
||
HELP = """Predictoor runner. | ||
Usage: python pdr_backend/predictoor/main.py APPROACH | ||
where APPROACH=1 does random predictions | ||
APPROACH=2 uses a model to predict. Needs MODELDIR specified. | ||
""" | ||
|
||
|
||
def _do_help(): | ||
print(HELP) | ||
sys.exit() | ||
|
||
|
||
def _do_main(): | ||
if len(sys.argv) <= 1: | ||
_do_help() | ||
|
||
arg1 = sys.argv[1] | ||
if arg1 == "1": | ||
from pdr_backend.predictoor.approach1.main import ( # pylint: disable=import-outside-toplevel,line-too-long | ||
main, | ||
) | ||
|
||
main() | ||
|
||
elif arg1 == "2": | ||
from pdr_backend.predictoor.approach2.main import ( # pylint: disable=import-outside-toplevel,line-too-long | ||
main, | ||
) | ||
|
||
main() | ||
|
||
elif arg1 == "help": | ||
_do_help() | ||
|
||
def main(): | ||
if len(sys.argv) == 1: | ||
main1() | ||
else: | ||
arg = sys.argv[1] | ||
if arg == "1": | ||
main1() | ||
elif arg == "2": | ||
main2() | ||
else: | ||
print("Invalid argument. Use '1' for approach1 or '2' for approach2.") | ||
_do_help() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
_do_main() |