Skip to content

Commit

Permalink
Merge pull request #697 from Avaiga/fix/job-and-submission-editable
Browse files Browse the repository at this point in the history
Make job and submission editable
  • Loading branch information
toan-quach authored Jan 17, 2024
2 parents 7fa780c + 158d6e0 commit c3c2140
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
10 changes: 3 additions & 7 deletions taipy/core/job/_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ def _get_latest(cls, task: Task) -> Optional[Job]:
def _is_deletable(cls, job: Union[Job, JobId]) -> bool:
if isinstance(job, str):
job = cls._get(job)
if job.is_finished():
return True
return False

@classmethod
def _is_editable(cls, entity: Union[Job, str]) -> bool:
return False
if not job.is_finished():
return False
return True
2 changes: 1 addition & 1 deletion taipy/core/submission/_submission_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _get_children_entity_ids(cls, submission: Submission):
return entity_ids

@classmethod
def _is_deletable(cls, submission: Union[Submission, SubmissionId]) -> bool:
def _is_deletable(cls, submission: Union[Submission, SubmissionId]) -> bool: # type: ignore
if isinstance(submission, str):
submission = cls._get(submission)
return submission.is_finished() or submission.submission_status == SubmissionStatus.UNDEFINED
5 changes: 2 additions & 3 deletions tests/core/job/test_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_create_jobs():
assert job_1.submit_id == "submit_id"
assert job_1.submit_entity_id == "secnario_id"
assert job_1.force
assert not _JobManager._is_editable(job_1)
assert _JobManager._is_editable(job_1)

job_2 = _JobManager._create(task, [print], "submit_id_1", "secnario_id", False)
assert _JobManager._get(job_2.id) == job_2
Expand All @@ -70,7 +70,7 @@ def test_create_jobs():
assert job_2.submit_id == "submit_id_1"
assert job_2.submit_entity_id == "secnario_id"
assert not job_2.force
assert not _JobManager._is_editable(job_2)
assert _JobManager._is_editable(job_2)


def test_get_job():
Expand Down Expand Up @@ -479,7 +479,6 @@ def test_is_deletable():
assert not _JobManager._is_deletable(job)
assert not _JobManager._is_deletable(job.id)


def _create_task(function, nb_outputs=1, name=None):
input1_dn_config = Config.configure_data_node("input1", "pickle", Scope.SCENARIO, default_data=21)
input2_dn_config = Config.configure_data_node("input2", "pickle", Scope.SCENARIO, default_data=2)
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_taipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_is_editable(self):
assert tp.is_editable(sequence)
assert tp.is_editable(task)
assert tp.is_editable(cycle)
assert not tp.is_editable(job)
assert tp.is_editable(job)
assert tp.is_editable(submission)
assert tp.is_editable(dn)

Expand Down

0 comments on commit c3c2140

Please sign in to comment.