Skip to content

Commit

Permalink
[backend] Set ssh_allowed to False if not set
Browse files Browse the repository at this point in the history
Fix #730

This mimicks the behaviour of _get_time_limit_estimate. It is not ideal as
it includes specific agent concepts into the job router code.

Replacing the parameter by a list of required capabilities could make the code
more generic in the long term.
  • Loading branch information
anthonygego committed Jan 5, 2022
1 parent 6694a40 commit 262e8d9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions inginious/backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def handle_client_new_job(self, client_addr, message: ClientNewJob):
self._logger.info("Adding a new job %s %s to the queue", client_addr, message.job_id)
job = WaitingJob(message.priority, time.time(), client_addr, message.job_id, message)
self._waiting_jobs[message.job_id] = job
self._waiting_jobs_pq.put((message.environment_type, message.environment, message.environment_parameters["ssh_allowed"]), job)
self._waiting_jobs_pq.put((message.environment_type, message.environment, self._get_ssh_allowed(message)), job)

await self.update_queue()

Expand Down Expand Up @@ -404,4 +404,11 @@ def _get_time_limit_estimate(self, job_info: ClientNewJob):
try:
return int(job_info.environment_parameters["limits"]["time"])
except:
return -1 # unknown
return -1 # unknown

def _get_ssh_allowed(self, job_info: ClientNewJob):
"""
Returns if the job requires that the agent allows ssh
For this to work, ["ssh_allowed"] must be a parameter of the environment.
"""
return job_info.environment_parameters.get("ssh_allowed", False)

0 comments on commit 262e8d9

Please sign in to comment.