Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cloud_pipelines_backend/orchestrator_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from . import component_structures as structures
from .launchers import common_annotations
from .launchers import interfaces as launcher_interfaces
from .instrumentation import bugsnag_instrumentation
from .instrumentation import contextual_logging
from .instrumentation import metrics as app_metrics

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line -82]

Need to report error here.

See this comment inline on Graphite.

Expand Down Expand Up @@ -66,8 +67,9 @@ def run_loop(self):
try:
self.process_each_queue_once()
time.sleep(self._sleep_seconds_between_queue_sweeps)
except Exception:
except Exception as exc:
_logger.exception("Error while calling `process_each_queue_once`")
bugsnag_instrumentation.notify(exception=exc)

def process_each_queue_once(self):
queue_handlers = [
Expand All @@ -78,8 +80,9 @@ def process_each_queue_once(self):
try:
with self._session_factory() as session:
queue_handler(session=session)
except Exception:
except Exception as exc:
_logger.exception(f"Error while executing {queue_handler=}")
bugsnag_instrumentation.notify(exception=exc)

def internal_process_queued_executions_queue(self, session: orm.Session):
query = (
Expand Down Expand Up @@ -1064,6 +1067,7 @@ def _retry(

def record_system_error_exception(execution: bts.ExecutionNode, exception: Exception):
app_metrics.execution_system_errors.add(1)
bugsnag_instrumentation.notify(exception=exception, execution_id=str(execution.id))

if execution.extra_data is None:
execution.extra_data = {}
Expand Down
2 changes: 2 additions & 0 deletions orchestrator_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from sqlalchemy import orm

from cloud_pipelines_backend import orchestrator_sql
from cloud_pipelines_backend.instrumentation import bugsnag_instrumentation
from cloud_pipelines_backend.launchers import kubernetes_launchers
from cloud_pipelines.orchestration.storage_providers import local_storage

Expand All @@ -32,6 +33,7 @@ def main():
logger.addHandler(stderr_handler)

logger.info("Starting the orchestrator")
bugsnag_instrumentation.setup(service_name="tangle-orchestrator")

DEFAULT_DATABASE_URI = "sqlite:///db.sqlite"
database_uri = os.environ.get("DATABASE_URI", DEFAULT_DATABASE_URI)
Expand Down
Loading