Skip to content

Commit

Permalink
Use job_id returned by the db
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i committed May 3, 2024
1 parent db364db commit 9539e79
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jupyter_scheduler/tests/test_execution_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from jupyter_scheduler.executors import DefaultExecutionManager
from jupyter_scheduler.orm import Job

JOB_ID = "69856f4e-ce94-45fd-8f60-3a587457fce7"
NOTEBOOK_NAME = "side_effects.ipynb"
SIDE_EFECT_FILE_NAME = "output_side_effect.txt"

Expand All @@ -17,24 +16,25 @@


@pytest.fixture
def load_job(jp_scheduler_db):
def create_job(jp_scheduler_db):
job = Job(
runtime_environment_name="abc",
input_filename=NOTEBOOK_NAME,
job_id=JOB_ID,
)
jp_scheduler_db.add(job)
jp_scheduler_db.commit()
return job.job_id


def test_add_side_effects_files(jp_scheduler_db, load_job, jp_scheduler_db_url):
def test_add_side_effects_files(jp_scheduler_db, create_job, jp_scheduler_db_url):
job_id = create_job
manager = DefaultExecutionManager(
job_id=JOB_ID,
job_id=job_id,
root_dir=str(NOTEBOOK_DIR),
db_url=jp_scheduler_db_url,
staging_paths={"input": str(NOTEBOOK_PATH)},
)
manager.add_side_effects_files(str(NOTEBOOK_DIR))

job = jp_scheduler_db.query(Job).filter(Job.job_id == JOB_ID).one()
job = jp_scheduler_db.query(Job).filter(Job.job_id == job_id).one()
assert SIDE_EFECT_FILE_NAME in job.packaged_files

0 comments on commit 9539e79

Please sign in to comment.