Skip to content

Commit

Permalink
Merge pull request #965 from roboflow/extend-logging-when-workflow-id…
Browse files Browse the repository at this point in the history
…-is-known-an-internal-workflow-id-was-not-passed

Add logging when workflow ID is known and internal workflow ID was not passed
  • Loading branch information
grzegorz-roboflow authored Jan 22, 2025
2 parents fe15be9 + 4bfc615 commit b175b5a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
7 changes: 7 additions & 0 deletions inference/core/interfaces/http/http_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,13 @@ async def infer_from_predefined_workflow(
workflow_id=workflow_id,
use_cache=workflow_request.use_cache,
)
if not workflow_request.workflow_id:
workflow_request.workflow_id = workflow_id
if not workflow_specification.get("id"):
logger.warning(
"Internal workflow ID missing in specification for '%s'",
workflow_id,
)
return process_workflow_inference_request(
workflow_request=workflow_request,
workflow_specification=workflow_specification,
Expand Down
2 changes: 1 addition & 1 deletion inference/core/interfaces/stream/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def multi_sink(
sink(predictions, video_frame)
except Exception as error:
logger.error(
f"Could not sent prediction with to sink due to error: {error}."
f"Could not send prediction and/or frame to sink due to error: {error}."
)


Expand Down
12 changes: 9 additions & 3 deletions inference/core/workflows/execution_engine/v1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from packaging.version import Version

from inference.core.logger import logger
from inference.core.workflows.execution_engine.entities.engine import (
BaseExecutionEngine,
)
Expand Down Expand Up @@ -91,14 +92,19 @@ def run(
input_substitutions=self._compiled_workflow.input_substitutions,
profiler=self._profiler,
)
usage_workflow_id = self._internal_id
if self._workflow_id and not usage_workflow_id:
logger.debug(
"Workflow ID is set to '%s' however internal Workflow ID is missing",
self._workflow_id,
)
usage_workflow_id = self._workflow_id
result = run_workflow(
workflow=self._compiled_workflow,
runtime_parameters=runtime_parameters,
max_concurrent_steps=self._max_concurrent_steps,
usage_fps=fps,
usage_workflow_id=(
self._workflow_id if not self._internal_id else self._internal_id
),
usage_workflow_id=usage_workflow_id,
usage_workflow_preview=_is_preview,
kinds_serializers=self._compiled_workflow.kinds_serializers,
serialize_results=serialize_results,
Expand Down
5 changes: 4 additions & 1 deletion inference/usage_tracking/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ def _update_usage_payload(
fps: float = 0,
):
source = str(source) if source else ""
frames = frames if isinstance(frames, numbers.Number) else 0
try:
frames = int(frames)
except Exception:
frames = 0
api_key_hash = self._calculate_api_key_hash(api_key=api_key)
if not resource_id and resource_details:
resource_id = UsageCollector._calculate_resource_hash(resource_details)
Expand Down

0 comments on commit b175b5a

Please sign in to comment.