whylogs.api.writer.whylabs_client#

Module Contents#

Classes#

Attributes#

whylogs.api.writer.whylabs_client.FIVE_MINUTES_IN_SECONDS#
whylogs.api.writer.whylabs_client.DAY_IN_SECONDS#
whylogs.api.writer.whylabs_client.FIVE_YEARS_IN_SECONDS#
whylogs.api.writer.whylabs_client.logger#
whylogs.api.writer.whylabs_client.WHYLOGS_PREFER_SYNC_KEY = 'WHYLOGS_PREFER_SYNC'#
whylogs.api.writer.whylabs_client.KNOWN_CUSTOM_PERFORMANCE_METRICS#
whylogs.api.writer.whylabs_client.KNOWN_CUSTOM_OUTPUT_METRICS#
exception whylogs.api.writer.whylabs_client.TransactionAbortedException#

Bases: Exception

Common base class for all non-exit exceptions.

class args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class whylogs.api.writer.whylabs_client.WhyLabsClient(org_id: Optional[str] = None, api_key: Optional[str] = None, dataset_id: Optional[str] = None, api_client: Optional[whylabs_client.ApiClient] = None, ssl_ca_cert: Optional[str] = None, _timeout_seconds: Optional[float] = None)#
Parameters
  • org_id (Optional[str]) –

  • api_key (Optional[str]) –

  • dataset_id (Optional[str]) –

  • api_client (Optional[whylabs_client.ApiClient]) –

  • ssl_ca_cert (Optional[str]) –

  • _timeout_seconds (Optional[float]) –

property key_id: str#
Return type

str

option(**kwargs) WhyLabsClient#
Parameters
  • ID (org_id the organization) –

  • Id (dataset_id the dataset) –

  • key (api_key the API) –

  • client (configuration the additional configuration for the REST) –

  • org_id (Optional[str] = None,) –

  • dataset_id (Optional[str] = None,) –

  • api_key (Optional[str] = None,) –

  • configuration (Optional[Configuration] = None,) –

  • ssl_ca_cert (Optional[str] = None,) –

  • api_client (Optional[ApiClient] = None,) –

  • timeout_seconds (Optional[float] = None,) –

  • transaction_id (Optional[str] = None,) –

  • prefer_sync

  • configured (Returns a "WhyLabsClient" with these options) –

  • -------

Return type

WhyLabsClient

tag_output_columns(columns: List[str]) Tuple[bool, str]#

Sets the list of columns as output columns for the specified dataset.

Parameters

columns (List[str]) – The list of column names you want to tag as outputs.

Returns

Tuple with a boolean indicating success or failure: e.g. (True, “column prediction was updated to output”) and string with status message.

Return type

Tuple[bool, str]

tag_input_columns(columns: List[str]) Tuple[bool, str]#

Sets the list of columns as input columns for the specified dataset.

Parameters

columns (List[str]) – The list of column names you want to tag as inputs.

Returns

Tuple with a boolean indicating success or failure: e.g. (True, “column [output_voltage] updated to input”) and string with status message.

Return type

Tuple[bool, str]

tag_custom_performance_column(column: str, label: Optional[str] = None, default_metric: str = 'mean') Tuple[bool, str]#

Sets the column as a custom performance metric for the specified dataset and org id. The default metric will be displayed in the Performance tab in WhyLabs.

Parameters
  • column (str) – The column name in the whylogs profile you want to tag as a custom performance metric.

  • label (str) – The label that will be displayed in WhyLabs UI. If none is passed, defaults to column name.

  • default_metric (str) – The default metric that will be displayed in the Performance tab in WhyLabs. For example, “mean”, “median”, “max”, or “min”. If none is passed, defaults to “mean”.

  • Note (the resulting custom performance metric is considered an unmergeable metric.) –

Return type

Tuple[bool, str]

write_feature_weights(file: whylogs.core.feature_weights.FeatureWeights, **kwargs: Any) Tuple[bool, str]#

Put feature weights for the specified dataset.

Parameters
  • file (FeatureWeights) – FeatureWeights object representing the Feature Weights for the specified dataset

  • kwargs (Any) –

Returns

Tuple with a boolean (1-success, 0-fail) and string with the request’s status code.

Return type

Tuple[bool, str]

get_feature_weights(**kwargs: Any) Optional[whylogs.core.feature_weights.FeatureWeights]#

Get latest version for the feature weights for the specified dataset

Returns

Response of the GET request, with segmentWeights and metadata.

Return type

FeatureWeightResponse

Parameters

kwargs (Any) –

do_upload(dataset_timestamp: int, upload_url: str, profile_id: str, profile_path: Optional[str] = None, profile_file: Optional[IO[bytes]] = None) Tuple[bool, str]#
Parameters
  • dataset_timestamp (int) –

  • upload_url (str) –

  • profile_id (str) –

  • profile_path (Optional[str]) –

  • profile_file (Optional[IO[bytes]]) –

Return type

Tuple[bool, str]

get_transaction_id() str#
Return type

str

commit_transaction(id: str) None#
Parameters

id (str) –

Return type

None

abort_transaction(id: str) None#
Parameters

id (str) –

Return type

None

transaction_status(id: str) Dict[str, Any]#
Parameters

id (str) –

Return type

Dict[str, Any]

get_upload_url_transaction(dataset_timestamp: int, whylabs_tags: List[whylabs_client.model.segment_tag.SegmentTag] = []) Tuple[str, str]#
Parameters
  • dataset_timestamp (int) –

  • whylabs_tags (List[whylabs_client.model.segment_tag.SegmentTag]) –

Return type

Tuple[str, str]

get_upload_url_batch_zip(dataset_timestamp: int) Tuple[str, str]#
Parameters

dataset_timestamp (int) –

Return type

Tuple[str, str]

get_upload_url_unsegmented_reference(dataset_timestamp: int, reference_profile_name: str) Tuple[str, str]#
Parameters
  • dataset_timestamp (int) –

  • reference_profile_name (str) –

Return type

Tuple[str, str]

get_upload_url_batch(dataset_timestamp: int) Tuple[str, str]#
Parameters

dataset_timestamp (int) –

Return type

Tuple[str, str]