Skip to content

Commit 57d6455

Browse files
authored
Add files via upload
1 parent e33b027 commit 57d6455

1 file changed

Lines changed: 6 additions & 44 deletions

File tree

sweagent/run/run.py

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,14 @@
2727
[bold][green]remove-unfinished[/green][/bold] or [bold][green]ru[/green][/bold]: Remove unfinished trajectories
2828
[bold][green]quick-stats[/green][/bold] or [bold][green]qs[/green][/bold]: Calculate quick stats from a directory of trajectories
2929
"""
30-
31-
import argparse
3230
import sys
33-
3431
import rich
32+
import argparse
3533

3634

3735
def get_cli():
3836
parser = argparse.ArgumentParser(add_help=False)
39-
parser.add_argument(
40-
"command",
41-
choices=[
42-
"run",
43-
"run-batch",
44-
"run-replay",
45-
"traj-to-demo",
46-
"run-api",
47-
"merge-preds",
48-
"inspect",
49-
"inspector",
50-
"r",
51-
"b",
52-
"i",
53-
"I",
54-
"extract-pred",
55-
"compare-runs",
56-
"cr",
57-
"remove-unfinished",
58-
"ru",
59-
"quick-stats",
60-
"qs",
61-
"shell",
62-
"sh",
63-
],
64-
nargs="?",
65-
)
37+
parser.add_argument("command", choices=["run", "run-batch", "run-replay", "traj-to-demo", "run-api", "merge-preds", "inspect", "inspector", "r", "b", "i", "I", "extract-pred", "compare-runs", "cr", "remove-unfinished", "ru", "quick-stats", "qs", "shell", "sh"], nargs="?")
6638
parser.add_argument("-h", "--help", action="store_true", help="Show this help message and exit")
6739
return parser
6840

@@ -88,60 +60,50 @@ def main(args: list[str] | None = None):
8860
# Defer imports to avoid unnecessary long loading times
8961
if command in ["run", "r"]:
9062
from sweagent.run.run_single import run_from_cli as run_single_main
91-
9263
run_single_main(remaining_args)
9364
elif command in ["run-batch", "b"]:
9465
from sweagent.run.run_batch import run_from_cli as run_batch_main
95-
9666
run_batch_main(remaining_args)
67+
elif command in ["run-locate"]:
68+
from sweagent.run.run_locate import run_from_cli as run_locate_main
69+
run_locate_main(remaining_args)
9770
elif command == "run-replay":
9871
from sweagent.run.run_replay import run_from_cli as run_replay_main
99-
10072
run_replay_main(remaining_args)
10173
elif command == "traj-to-demo":
10274
from sweagent.run.run_traj_to_demo import run_from_cli as convert_traj_to_demo_main
103-
10475
convert_traj_to_demo_main(remaining_args)
10576
elif command == "run-api":
10677
from sweagent.api.server import run_from_cli as run_api_main
107-
10878
run_api_main(remaining_args)
10979
elif command == "merge-preds":
11080
from sweagent.run.merge_predictions import run_from_cli as merge_predictions_main
111-
11281
merge_predictions_main(remaining_args)
11382
elif command in ["inspector", "I"]:
11483
from sweagent.inspector.server import run_from_cli as inspector_main
115-
11684
inspector_main(remaining_args)
11785
elif command in ["inspect", "i"]:
11886
from sweagent.run.inspector_cli import main as inspect_main
119-
12087
inspect_main(remaining_args)
12188
elif command == "extract-pred":
12289
from sweagent.run.extract_pred import run_from_cli as extract_pred_main
123-
12490
extract_pred_main(remaining_args)
12591
elif command in ["compare-runs", "cr"]:
12692
from sweagent.run.compare_runs import run_from_cli as compare_runs_main
127-
12893
compare_runs_main(remaining_args)
12994
elif command in ["remove-unfinished", "ru"]:
13095
from sweagent.run.remove_unfinished import run_from_cli as remove_unfinished_main
131-
13296
remove_unfinished_main(remaining_args)
13397
elif command in ["quick-stats", "qs"]:
13498
from sweagent.run.quick_stats import run_from_cli as quick_stats_main
135-
13699
quick_stats_main(remaining_args)
137100
elif command in ["shell", "sh"]:
138101
from sweagent.run.run_shell import run_from_cli as run_shell_main
139-
140102
run_shell_main(remaining_args)
141103
else:
142104
msg = f"Unknown command: {command}"
143105
raise ValueError(msg)
144106

145107

146108
if __name__ == "__main__":
147-
sys.exit(main())
109+
sys.exit(main())

0 commit comments

Comments
 (0)