|
16 | 16 | from jumpbox_io import download_from_jumpbox, upload_to_jumpbox |
17 | 17 |
|
18 | 18 |
|
19 | | -def cmd_download(args: argparse.Namespace) -> int: |
20 | | - """ |
21 | | - Download analysis files from jumpbox. |
22 | | -
|
23 | | - Args: |
24 | | - args: Parsed command-line arguments |
25 | | -
|
26 | | - Returns: |
27 | | - 0 on success, 1 on failure |
28 | | - """ |
29 | | - print(f"Downloading analysis files for job {args.job_id}...") |
30 | | - |
31 | | - if download_from_jumpbox(args.job_id): |
32 | | - print(f"\n Analysis files ready at .analysis/{args.job_id}/") |
33 | | - return 0 |
34 | | - else: |
35 | | - print("\n Failed to download analysis files") |
36 | | - print(" Check JUMPBOX_URI environment variable and SSH configuration") |
37 | | - return 1 |
38 | | - |
39 | | - |
40 | | -def cmd_upload(args: argparse.Namespace) -> int: |
41 | | - """ |
42 | | - Upload annotation_draft.json to jumpbox. |
43 | | -
|
44 | | - Args: |
45 | | - args: Parsed command-line arguments |
46 | | -
|
47 | | - Returns: |
48 | | - 0 on success, 1 on failure |
49 | | - """ |
50 | | - print(f"Uploading annotation for job {args.job_id}...") |
51 | | - |
52 | | - if upload_to_jumpbox(args.job_id): |
53 | | - print("\n Annotation uploaded successfully") |
54 | | - return 0 |
55 | | - else: |
56 | | - print("\n Failed to upload annotation") |
57 | | - return 1 |
58 | | - |
59 | | - |
60 | 19 | def main(): |
61 | 20 | """Main entry point for CLI.""" |
62 | 21 | parser = argparse.ArgumentParser( |
@@ -106,15 +65,28 @@ def main(): |
106 | 65 | parser.print_help() |
107 | 66 | return 1 |
108 | 67 |
|
109 | | - # Execute command |
| 68 | + job_id = args.job_id |
| 69 | + |
110 | 70 | if args.command == "download": |
111 | | - return cmd_download(args) |
112 | | - elif args.command == "upload": |
113 | | - return cmd_upload(args) |
114 | | - else: |
115 | | - print(f"Unknown command: {args.command}") |
| 71 | + print(f"Downloading analysis files for job {job_id}...") |
| 72 | + if download_from_jumpbox(job_id): |
| 73 | + print(f"\n Analysis files ready at .analysis/{job_id}/") |
| 74 | + return 0 |
| 75 | + print("\n Failed to download analysis files") |
| 76 | + print(" Check JUMPBOX_URI environment variable and SSH configuration") |
116 | 77 | return 1 |
117 | 78 |
|
| 79 | + if args.command == "upload": |
| 80 | + print(f"Uploading annotation for job {job_id}...") |
| 81 | + if upload_to_jumpbox(job_id): |
| 82 | + print("\n Annotation uploaded successfully") |
| 83 | + return 0 |
| 84 | + print("\n Failed to upload annotation") |
| 85 | + return 1 |
| 86 | + |
| 87 | + print(f"Unknown command: {args.command}") |
| 88 | + return 1 |
| 89 | + |
118 | 90 |
|
119 | 91 | if __name__ == "__main__": |
120 | 92 | sys.exit(main()) |
0 commit comments