Skip to content

Commit

Permalink
feat(api): Add compute4punch backend
Browse files Browse the repository at this point in the history
  • Loading branch information
giffels committed Jul 3, 2024
1 parent f2faeaa commit bdc65d4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
15 changes: 15 additions & 0 deletions reana_commons/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def submit(
slurm_partition="",
slurm_time="",
kubernetes_job_timeout: Optional[int] = None,
c4p_cpu_cores="",
c4p_memory_limit="",
c4p_additional_requirements="",
):
"""Submit a job to RJC API.
Expand All @@ -132,6 +135,9 @@ def submit(
:param slurm_partition: Partition of a Slurm job.
:param slurm_time: Maximum timelimit of a Slurm job.
:param kubernetes_job_timeout: Timeout for the job in seconds.
:param c4p_cpu_cores: Amount of CPU cores requested to process C4P job
:param c4p_memory_limit: Amount of memory requested to process C4P job
:param c4p_additional_requirements: Additional requirements requested to process C4P job like GPU, etc.
:return: Returns a dict with the ``job_id``.
"""
job_spec = {
Expand Down Expand Up @@ -181,6 +187,15 @@ def submit(
if slurm_time:
job_spec["slurm_time"] = slurm_time

if c4p_cpu_cores:
job_spec["c4p_cpu_cores"]

if c4p_memory_limit:
job_spec["c4p_memory_limit"]

if c4p_additional_requirements:
job_spec["c4p_additional_requirements"]

try:
response, http_response = self._client.jobs.create_job(
job=job_spec
Expand Down
3 changes: 2 additions & 1 deletion reana_commons/openapi_specifications/reana_server.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@
"value": [
"kubernetes",
"htcondorcern",
"slurmcern"
"slurmcern",
"compute4punch"
]
},
"default_kubernetes_jobs_timeout": {
Expand Down
17 changes: 16 additions & 1 deletion reana_commons/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"compute_backend": {
"$id": "#/properties/steps/properties/compute_backend",
"type": "string",
"enum": ["kubernetes", "htcondorcern", "slurmcern"],
"enum": ["kubernetes", "htcondorcern", "slurmcern", "compute4punch"],
},
"kerberos": {
"$id": "#/properties/steps/properties/kerberos",
Expand Down Expand Up @@ -98,6 +98,21 @@
"type": "string",
"default": "",
},
"c4p_cpu_cores": {
"$id": "#/properties/steps/properties/c4p_cpu_cores",
"type": "string",
"default": "",
},
"c4p_memory_limit": {
"$id": "#/properties/steps/properties/c4p_memory_limit",
"type": "string",
"default": "",
},
"c4p_additional_requirements": {
"$id": "#/properties/steps/properties/c4p_additional_requirements",
"type": "string",
"default": "",
},
"commands": {
"$id": "#/properties/steps/properties/commands",
"type": "array",
Expand Down
18 changes: 17 additions & 1 deletion reana_commons/validation/schemas/reana_analysis_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@
"enum": [
"kubernetes",
"htcondorcern",
"slurmcern"
"slurmcern",
"compute4punch"
],
"title": "Compute backend"
},
Expand Down Expand Up @@ -297,6 +298,21 @@
"type": "boolean",
"title": "VOMS proxy",
"description": "Whether to use a VOMS proxy for the step. This would require you to upload a valid VOMS proxy as a REANA secret."
},
"c4p_cpu_cores": {
"type": "string",
"title": "C4P CPU Cores",
"description": "Number of CPU cores requested from Compute4PUNCH for running the task."
},
"c4p_memory_limit": {
"type": "string",
"title": "C4P Memory Limit",
"description": "Amount of memory requested from Compute4PUNCH for running the task."
},
"c4p_additional_requirements": {
"type": "string",
"title": "C4P Additional Requirements",
"description": "Additional HTCondor requirements like RequestGPUs for running the task."
}
},
"required": [
Expand Down

0 comments on commit bdc65d4

Please sign in to comment.