Skip to content

Commit 7c2612a

Browse files
committed
Bulk generator: Specify a path to the PAT instead of the PAT itself.
1 parent 1228080 commit 7c2612a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

misc/scripts/models-as-data/bulk_generate_mad.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,18 @@ def main(config, args) -> None:
441441
if experiment_name is None:
442442
print("ERROR: --dca argument is required for DCA strategy")
443443
sys.exit(1)
444-
pat = args.pat
445-
if pat is None:
444+
445+
if args.pat is None:
446446
print("ERROR: --pat argument is required for DCA strategy")
447447
sys.exit(1)
448-
database_results = download_dca_databases(experiment_name, pat, projects)
448+
if not os.path.exists(args.pat):
449+
print(f"ERROR: Personal Access Token file '{pat}' does not exist.")
450+
sys.exit(1)
451+
with open(args.pat, "r") as f:
452+
pat = f.read().strip()
453+
database_results = download_dca_databases(
454+
experiment_name, pat, projects
455+
)
449456

450457
# Generate models for all projects
451458
print("\n=== Generating models ===")
@@ -485,7 +492,7 @@ def main(config, args) -> None:
485492
parser.add_argument(
486493
"--pat",
487494
type=str,
488-
help="PAT token to grab DCA databases (the same as the one you use for DCA)",
495+
help="Path to a file containing the PAT token required to grab DCA databases (the same as the one you use for DCA)",
489496
required=False,
490497
)
491498
args = parser.parse_args()

0 commit comments

Comments
 (0)