Skip to content

Commit

Permalink
Merge pull request #537 from roboflow/adjust-usage-collector
Browse files Browse the repository at this point in the history
Adjust usage collector
  • Loading branch information
grzegorz-roboflow authored Jul 18, 2024
2 parents 2be4fb5 + 3877769 commit f0d6356
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion inference/core/interfaces/stream/inference_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ def init_with_workflow(
execution_engine = ExecutionEngine.init(
workflow_definition=workflow_specification,
init_parameters=workflow_init_parameters,
api_key=api_key,
workflow_id=workflow_id,
)
workflow_runner = WorkflowRunner()
Expand Down
6 changes: 0 additions & 6 deletions inference/core/workflows/execution_engine/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ def init(
init_parameters: Optional[Dict[str, Any]] = None,
max_concurrent_steps: int = 1,
prevent_local_images_loading: bool = False,
api_key: Optional[str] = None,
workflow_id: Optional[str] = None,
) -> "ExecutionEngine":
if api_key is None:
api_key = API_KEY
if init_parameters is None:
init_parameters = {}
compiled_workflow = compile_workflow(
Expand All @@ -38,7 +35,6 @@ def init(
compiled_workflow=compiled_workflow,
max_concurrent_steps=max_concurrent_steps,
prevent_local_images_loading=prevent_local_images_loading,
api_key=api_key,
workflow_id=workflow_id,
)

Expand All @@ -47,13 +43,11 @@ def __init__(
compiled_workflow: CompiledWorkflow,
max_concurrent_steps: int,
prevent_local_images_loading: bool,
api_key: Optional[str] = None,
workflow_id: Optional[str] = None,
):
self._compiled_workflow = compiled_workflow
self._max_concurrent_steps = max_concurrent_steps
self._prevent_local_images_loading = prevent_local_images_loading
self._api_key = api_key
self._workflow_id = workflow_id

def run(
Expand Down
12 changes: 0 additions & 12 deletions inference/usage_tracking/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
UsagePayload = Union[APIKeyUsage, ResourceDetails, SystemDetails]


ENTERPRISE_WARNING_MESSAGE: str = """
It seems there was a problem sending telemetry to Roboflow platform.
If usage tracking is part of your agreement with Roboflow you are required to have your usage sent.
"""


class UsageCollector:
_lock = Lock()
_async_lock = asyncio.Lock()
Expand Down Expand Up @@ -162,8 +156,6 @@ def _zip_usage_payloads(usage_payloads: List[APIKeyUsage]) -> List[APIKeyUsage]:
and len(resource_payloads) > 1
or list(resource_payloads.keys()) != [None]
):
if any(r.get("enterprise") for r in resource_payloads.values()):
logger.error(ENTERPRISE_WARNING_MESSAGE)
logger.debug(
"Dropping usage payload %s due to missing API key",
resource_payloads,
Expand Down Expand Up @@ -521,14 +513,10 @@ def _offload_to_api(self, payloads: List[APIKeyUsage]):
timeout=1,
)
except Exception as exc:
if enterprise:
logger.error(ENTERPRISE_WARNING_MESSAGE)
logger.debug("Failed to send usage - %s", exc)
api_keys_failed.add(api_key)
continue
if response.status_code != 200:
if enterprise:
logger.error(ENTERPRISE_WARNING_MESSAGE)
logger.debug(
"Failed to send usage - got %s status code (%s)",
response.status_code,
Expand Down

0 comments on commit f0d6356

Please sign in to comment.