-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
1 parent
337f552
commit c17df0e
Showing
19 changed files
with
123 additions
and
178 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
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
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,4 +1,4 @@ | ||
from .data_models import Task | ||
from .launch import Launcher | ||
from .logger import Logger | ||
from .steps import ApplyWorker, CombineWorker, RollbackWorker, SplitWorker | ||
from .runtests import ApplyWorker, CombineWorker, SplitWorker |
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
1 change: 0 additions & 1 deletion
1
validity/scripts/steps/__init__.py → validity/scripts/runtests/__init__.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,4 +1,3 @@ | ||
from .apply import ApplyWorker | ||
from .combine import CombineWorker | ||
from .rollback import RollbackWorker | ||
from .split import SplitWorker |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from contextlib import contextmanager | ||
|
||
from core.choices import JobStatusChoices | ||
from core.models import Job | ||
|
||
|
||
class TerminateMixin: | ||
def terminate_job(self, job: Job, status: str, error: str | None = None, logs=None, output=None): | ||
logs = logs or [] | ||
job.data = {"log": [log.serialized for log in logs], "output": output} | ||
job.terminate(status, error) | ||
|
||
def terminate_errored_job(self, job: Job, type, value, traceback): | ||
logger = self.log_factory() | ||
logger.log_exception(value, type, traceback) | ||
logger.info("Database changes have been reverted") | ||
self.terminate_job(job, status=JobStatusChoices.STATUS_ERRORED, error=repr(value), logs=logger.messages) | ||
|
||
@contextmanager | ||
def terminate_job_on_error(self, job: Job): | ||
try: | ||
yield | ||
except Exception as err: | ||
self.terminate_errored_job(job, type(err), err, err.__traceback__) | ||
raise |
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
Oops, something went wrong.