Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Improvement] Do not wait for non tutor jobs while running k8s. (by @mlabeeb03)
10 changes: 6 additions & 4 deletions tutor/commands/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

from tutor import config as tutor_config
from tutor import env as tutor_env
from tutor import exceptions, fmt, hooks
from tutor import exceptions, fmt, hooks, serialize, utils
from tutor import interactive as interactive_config
from tutor import serialize, utils
from tutor.commands import jobs
from tutor.commands.config import save as config_save_command
from tutor.commands.context import BaseTaskContext
Expand Down Expand Up @@ -187,7 +186,7 @@ def _load_jobs(self) -> Iterable[Any]:

def active_job_names(self) -> List[str]:
"""
Return a list of active job names
Return a list of active job names that are managed by tutor.
Docs:
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#list-job-v1-batch

Expand All @@ -197,7 +196,10 @@ def active_job_names(self) -> List[str]:
api = K8sClients.instance().batch_api
return [
job.metadata.name
for job in api.list_namespaced_job(k8s_namespace(self.config)).items
for job in api.list_namespaced_job(
k8s_namespace(self.config),
label_selector="app.kubernetes.io/managed-by=tutor",
).items
if job.status.active
]

Expand Down