Skip to content

Commit 2ba446b

Browse files
zenotech-ciZenotech Bot
authored andcommitted
Project import generated by Copybara.
GitOrigin-RevId: bb4b5dc68657b3c00105b1bf0f49ad93b63612ea
1 parent e7f49ee commit 2ba446b

4 files changed

Lines changed: 249 additions & 237 deletions

File tree

epiccli/catalog.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ def list_instances(project_config):
7878
for instance in sorted_instances:
7979
price_per_hour = instance.get('price_per_hour', 0)
8080
if price_per_hour > 0:
81+
efa_str = "EFA Supported" if instance.get('efa_supported') else "No EFA"
8182
click.echo(
8283
f"- {instance['instance_type']}: "
8384
f"{instance['vcpus']} vCPUs, "
8485
f"{instance['memory_gb']:.2f} GB Memory, "
85-
f"${instance.get('price_per_hour', 0):.4f}/hr"
86+
f"${instance.get('price_per_hour', 0):.4f}/hr, "
87+
f"{efa_str}"
8688
)
8789

8890
except requests.exceptions.RequestException as e:

epiccli/job.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ def create_job(job_json_file, project_config):
2828
with open(job_json_file) as f:
2929
job_data = json.load(f)
3030

31+
jobs_list = job_data.get("jobs", []) if isinstance(job_data, dict) and "jobs" in job_data else [job_data]
32+
for job_item in jobs_list:
33+
if isinstance(job_item, dict):
34+
tasks = job_item.get("spec", {}).get("tasks", [])
35+
for task in tasks:
36+
partitions = int(task.get("partitions", 1))
37+
nodes = int(task.get("nodes", 2)) if task.get("task_distribution") == "node" else 1
38+
39+
if partitions < nodes:
40+
click.echo(f"Error: Number of partitions ({partitions}) must be greater than or equal to number of nodes ({nodes}).")
41+
return
42+
if partitions % nodes != 0:
43+
click.echo(f"Error: Number of partitions ({partitions}) must be exactly divisible by number of nodes ({nodes}).")
44+
return
45+
3146
response = requests.post(f"{api_url}/job/", headers=headers, json=job_data)
3247
response.raise_for_status()
3348
job_response = response.json()

epiccli/main.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ def create_job_command(job_json_file, project_name):
459459
460460
- `instance_types`: A list of instance types to use for the job. If not
461461
specified, the default instance types are used.
462+
- `capacity_reservation_id`: (Optional) The ID of a Capacity Reservation (e.g., Capacity Blocks for ML) to target for the job.
463+
- `task_distribution`: (Optional) The task distribution strategy (e.g., "core" or "node").
464+
- `nodes`: (Optional) The number of nodes to use for the job, typically used when `task_distribution` is "node".
462465
- Use the `epic catalog list-instances` command to see the available instance types.
463466
464467
.. code-block:: json
@@ -492,15 +495,16 @@ def create_job_command(job_json_file, project_name):
492495
"spec": {
493496
"app_code": "my-openfoam2212",
494497
"tasks": [{"reference": "main-task",
495-
"partitions": 32,
498+
"partitions": 64,
499+
"nodes": 2,
496500
"runtime": 1,
497-
"task_distribution": "core",
501+
"task_distribution": "node",
498502
"memory_gb": 16,
499-
"instance_types": ["m5.xlarge"]
503+
"instance_types": ["c5n.18xlarge"]
500504
}]
501505
},
502506
"input_data": {"path": "v2212/motorBike"},
503-
"app_options": {"base_command": "su sudofoam -c '. /usr/lib/openfoam/openfoam2212/etc/bashrc && ls -lta && ./Allclean && ./Allrun'"},
507+
"app_options": {"base_command": "su sudofoam -c '. /usr/lib/openfoam/openfoam2212/etc/bashrc && ls -lta && cat /tmp/hostfile && mpirun -np 64 -x PATH -x LD_LIBRARY_PATH -x WM_PROJECT_DIR -x FOAM_SETTINGS --hostfile /tmp/hostfile --use-hwthread-cpus simpleFoam -parallel | tee run.log && reconstructPar -latestTime'"},
504508
"cluster": {"queue_code": "batch-single-node"}
505509
}]
506510
}

0 commit comments

Comments
 (0)