Skip to content

Commit 939a2aa

Browse files
committed
Only validate notebooks have a kernel for .ipynb files
1 parent 09e3fac commit 939a2aa

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

jupyter_scheduler/python_executor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def add_side_effects_files(self, staging_dir: str):
7171
)
7272
session.commit()
7373

74+
def validate(cls, input_path: str) -> bool:
75+
"""Python scripts don't require kernel validation like notebooks."""
76+
return True
77+
7478
@classmethod
7579
def supported_features(cls) -> Dict[JobFeature, bool]:
7680
return {

jupyter_scheduler/scheduler.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,14 @@ def create_job(self, model: CreateJob) -> str:
442442
raise InputUriError(model.input_uri)
443443

444444
input_path = os.path.join(self.root_dir, model.input_uri)
445-
if not self.execution_manager_class.validate(self.execution_manager_class, input_path):
446-
raise SchedulerError(
447-
"""There is no kernel associated with the notebook. Please open
448-
the notebook, select a kernel, and re-submit the job to execute.
449-
"""
450-
)
445+
# Validate notebooks have a kernel (Python scripts and other file types skip this)
446+
if input_path.endswith(".ipynb"):
447+
if not self.execution_manager_class.validate(self.execution_manager_class, input_path):
448+
raise SchedulerError(
449+
"""There is no kernel associated with the notebook. Please open
450+
the notebook, select a kernel, and re-submit the job to execute.
451+
"""
452+
)
451453

452454
with self.db_session() as session:
453455
if model.idempotency_token:

0 commit comments

Comments
 (0)