-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
from trailblazer.apps.slurm.api import get_slurm_queue | ||
from trailblazer.apps.slurm.models import SqueueResult, SqueueJob | ||
from trailblazer.clients.slurm_cli_client.utils import create_job_info_dto | ||
from trailblazer.services.slurm.dtos import JobInfoDto | ||
from trailblazer.services.slurm.dtos import SlurmJobInfo | ||
|
||
|
||
class SlurmCLIClient: | ||
def __init__(self, host: str): | ||
self.host = host | ||
|
||
def get_job(self, job_id: str) -> JobInfoDto: | ||
def get_job_info(self, job_id: str) -> SlurmJobInfo: | ||
queue: SqueueResult = get_slurm_queue(job_ids=[job_id], analysis_host=self.host) | ||
job: SqueueJob = queue.jobs[0] | ||
return create_job_info_dto(job) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
trailblazer/services/slurm/slurm_cli_service/slurm_cli_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from trailblazer.clients.slurm_cli_client.slurm_cli_client import SlurmCLIClient | ||
from trailblazer.services.slurm.dtos import JobInfoDto | ||
from trailblazer.services.slurm.dtos import SlurmJobInfo | ||
from trailblazer.services.slurm.slurm_service import SlurmService | ||
|
||
|
||
class SlurmCLIService(SlurmService): | ||
def __init__(self, client: SlurmCLIClient): | ||
self.client = client | ||
|
||
def get_job_info(self, job_id: str) -> JobInfoDto: | ||
return self.client.get_job(job_id) | ||
def get_job_info(self, job_id: str) -> SlurmJobInfo: | ||
return self.client.get_job_info(job_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
from trailblazer.services.slurm.dtos import JobInfoDto | ||
from trailblazer.services.slurm.dtos import SlurmJobInfo | ||
|
||
|
||
class SlurmService(ABC): | ||
@abstractmethod | ||
def get_job_info(self, job_id: str) -> JobInfoDto: | ||
def get_job_info(self, job_id: str) -> SlurmJobInfo: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters