You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method checks whether the user has specified all mandatory parameters for all sources. Even if the metric has one or more issues, if not all mandatory parameters are present, the metric is skipped. If there are no sources at all, the metric is also skipped.
def__can_collect(self, metric: dict) ->bool:
"""Return whether the user has specified all mandatory parameters for all sources."""sources=metric.get("sources", {})
forsourceinsources.values():
parameters=self.data_model.get("sources", {}).get(source["type"], {}).get("parameters", {})
forparameter_key, parameterinparameters.items():
if (
parameter.get("mandatory")
andmetric["type"] inparameter.get("metrics")
andnotsource.get("parameters", {}).get(parameter_key)
andnotparameter.get("default_value")
):
returnFalsereturnbool(sources)
The text was updated successfully, but these errors were encountered:
Move the parameter check to SourceCollector.collect(), and if it fails, skip collecting and parsing the source responses.
asyncdefcollect(self) ->SourceMeasurement:
"""Return the measurement from this source."""ifself.__all_mandatory_parameters_ok(...):
responses=awaitself.__safely_get_source_responses()
measurement=awaitself.__safely_parse_source_responses(responses)
measurement.api_url=responses.api_urlmeasurement.landing_url=awaitself.__safely_parse_landing_url(responses)
else:
measurement=SourceMeasurement()
returnmeasurement
This method checks whether the user has specified all mandatory parameters for all sources. Even if the metric has one or more issues, if not all mandatory parameters are present, the metric is skipped. If there are no sources at all, the metric is also skipped.
The text was updated successfully, but these errors were encountered: