Skip to content

Commit 0154517

Browse files
committed
Enh(aws): Better names for jobs; allow to skip git check
1 parent a1a430e commit 0154517

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

aws/run_job.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
python run_job.py -- main.py configs/test/battlesnake_pvp_test.yaml
1010
python run_job.py --job-name my-test -- main.py @battlesnake_pvp_test.yaml --suffix test-run
1111
python run_job.py --wait --show-logs -- python -m pytest tests/
12+
python run_job.py -y -- main.py configs/test/battlesnake_pvp_test.yaml
1213
"""
1314

1415
import argparse
@@ -58,8 +59,16 @@ def get_latest_job_definition_arn(self) -> str:
5859
def submit_job(self, command: list[str], job_name: str | None = None) -> str:
5960
"""Submit a job to AWS Batch."""
6061
if job_name is None:
62+
human_name = command[0]
63+
# If have config take that instead
64+
for arg in command:
65+
if arg.startswith("configs/") or "/configs/" in arg:
66+
config_name = arg.split("/")[-1]
67+
human_name = (
68+
config_name.replace(".yaml", "").replace(".yml", "").replace(" ", "_").replace(".", "-")
69+
)
6170
timestamp = int(time.time())
62-
job_name = f"codeclash-{timestamp}"
71+
job_name = f"codeclash-{human_name}-{timestamp}"
6372

6473
# Get current git branch and prepend it to the command
6574
current_branch = get_current_git_branch()
@@ -152,6 +161,7 @@ def main():
152161
parser.add_argument("--job-queue", default="codeclash-queue", help="Job queue name (default: codeclash-queue)")
153162
parser.add_argument("--wait", action="store_true", help="Wait for the job to complete before exiting")
154163
parser.add_argument("--show-logs", action="store_true", help="Show job logs after completion (implies --wait)")
164+
parser.add_argument("-y", action="store_true", help="Skip git dirty prompt and continue automatically")
155165

156166
if "--" in sys.argv:
157167
separator_index = sys.argv.index("--")
@@ -162,7 +172,8 @@ def main():
162172

163173
args = parser.parse_args(aws_args)
164174

165-
check_git_status_and_confirm()
175+
if not args.y:
176+
check_git_status_and_confirm()
166177

167178
launcher = AWSBatchJobLauncher(job_definition_name=args.job_definition, job_queue=args.job_queue)
168179

0 commit comments

Comments
 (0)