Skip to content

Commit

Permalink
Merge pull request #4 from TheRacetrack/3-track-nested-exceptions-tra…
Browse files Browse the repository at this point in the history
…ceback

Track nested exception's traceback
  • Loading branch information
iszulcdeepsense committed Feb 15, 2023
2 parents e4541f7 + ee22cf8 commit 5e37869
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,23 @@ def list_jobs(self, config: Config) -> Iterable[JobDto]:
yield job

def check_job_condition(self,
job: JobDto,
deployment_timestamp: int = 0,
on_job_alive: Callable = None,
logs_on_error: bool = True,
):
job: JobDto,
deployment_timestamp: int = 0,
on_job_alive: Callable = None,
logs_on_error: bool = True,
):
try:
check_until_job_is_operational(self._get_internal_job_url(job),
deployment_timestamp, on_job_alive)
deployment_timestamp, on_job_alive)
except Exception as e:
if logs_on_error:
try:
logs = self.read_recent_logs(job)
except (AssertionError, ApiException, CommandError):
raise RuntimeError(str(e))
raise RuntimeError(f'{e}\nJob logs:\n{logs}')
raise RuntimeError(str(e)) from e
raise RuntimeError(f'{e}\nJob logs:\n{logs}') from e
else:
raise RuntimeError(str(e))
raise RuntimeError(str(e)) from e

def read_recent_logs(self, job: JobDto, tail: int = 20) -> str:
resource_name = job_resource_name(job.name, job.version)
Expand Down
2 changes: 1 addition & 1 deletion src/plugin-manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: kubernetes-infrastructure
version: 1.2.0
version: 1.2.1
url: https://github.com/TheRacetrack/plugin-kubernetes-infrastructure

0 comments on commit 5e37869

Please sign in to comment.