-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RHODS-8871: Remove mandatory typing from requests #186
Conversation
@RobGeada: This pull request references RHODS-8871 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RobGeada The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, some comments but mainly minor/codestyle
Good PR :)
sed -i "s#value: \"quay.io/trustyai/trustyai-service:latest\"#value: \"quay.io/trustyai/trustyai-service-ci:${BRANCH_SHA}#" | ||
BRANCH_SHA=$(curl https://api.github.com/repos/trustyai-explainability/trustyai-explainability/pulls/164 | jq ".head.sha" | tr -d '"') | ||
sed -i "s#value: \"quay.io/trustyai/trustyai-service:latest\"#value: \"quay.io/trustyai/trustyai-service-ci:${BRANCH_SHA}\"#" ./${KFDEF_FILENAME} | ||
cat ./${KFDEF_FILENAME} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful in the logs of the CI, I'd like to keep it
...c/test/java/org/kie/trustyai/service/endpoints/metrics/DisparateImpactRatioEndpointTest.java
Outdated
Show resolved
Hide resolved
@@ -7,5 +7,6 @@ public enum DataType { | |||
INT32, | |||
INT64, | |||
STRING, | |||
MAP | |||
MAP, | |||
UNKNOWN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused? I don't see any usage of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which? I use UNKNOWN. Tommaso added MAP
explainability-service/src/main/java/org/kie/trustyai/service/payloads/PayloadConverter.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/kie/trustyai/service/endpoints/metrics/DisparateImpactRatioEndpoint.java
Outdated
Show resolved
Hide resolved
return Response.ok(calculator.getDIRDefinition(request.getMetricValue(), request)).build(); | ||
final ReconciledMetricRequest reconciledMetricRequest; | ||
try { | ||
reconciledMetricRequest = ReconciledMetricRequest.reconcile(request, dataSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the reconcile
method here is invoked in a try/catch
while in the dir
method this is not the case?
Are you sure the DataframeCreateException
cannot happen in that method too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this function, I'm calling:
ReconciledMetricRequest.reconcile(rawRequest, dataSource)
In dir
, I'm calling:
ReconciledMetricRequest.reconcile(rawRequest, metadata)
The DataframeCreateException
can be thrown on the creation of metadata
from a dataSource
, which happens only in the first invocation.
...ava/org/kie/trustyai/service/endpoints/metrics/GroupStatisticalParityDifferenceEndpoint.java
Show resolved
Hide resolved
this.privilegedAttribute = new TypedValue(); | ||
this.privilegedAttribute.setType(protectedType); | ||
this.privilegedAttribute.setValue(request.getPrivilegedAttribute()); | ||
|
||
this.unprivilegedAttribute = new TypedValue(); | ||
this.unprivilegedAttribute.setType(protectedType); | ||
this.unprivilegedAttribute.setValue(request.getUnprivilegedAttribute()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that privilegedAttribute
and unprivilegedAttribute
have the same type (protectedType
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They will need to, yes
public static ReconciledMetricRequest reconcile(BaseMetricRequest request, Instance<DataSource> dataSource) { | ||
final Metadata metadata = dataSource.get().getMetadata(request.getModelId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a minor comment but I would prefer to do the get()
outside this class (aka remove this overload and keep the other method) to avoid to bring usage of javax.enterprise.inject.Instance
(aka J2EE) into this class.
As alternative you can replace Instance
with Supplier
and invoke this method like reconcile(request, dataSource::get)
Btw this is minor, it is mainly to limit the spreading of J2EE classes
public ReconciledMetricRequest(String protectedAttribute, String outcomeName, String modelId, String requestName, String metricName, Double thresholdDelta, Integer batchSize, | ||
TypedValue privilegedAttribute, TypedValue favorableOutcome, TypedValue unprivilegedAttribute) { | ||
this.protectedAttribute = protectedAttribute; | ||
this.outcomeName = outcomeName; | ||
this.modelId = modelId; | ||
this.requestName = requestName; | ||
this.metricName = metricName; | ||
this.thresholdDelta = thresholdDelta; | ||
this.batchSize = batchSize; | ||
this.privilegedAttribute = privilegedAttribute; | ||
this.favorableOutcome = favorableOutcome; | ||
this.unprivilegedAttribute = unprivilegedAttribute; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I see it is not used, if so, can you remove it?
I'm not a fan of constructors with a lot of fields with the same type like here (String abc, String def, String ghi
) because it is easy to swap a parameter and get a bug.
Especially if it is not used :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in the creation of the ReconciledDefinitionRequest
class, in the super()
invocation
/ok-to-test |
@RobGeada: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Metric requests now look like:
Request values are compared to see if they are compatible with the expected types from the metadata.
Many thanks for submitting your Pull Request ❤️!
Please make sure that your PR meets the following requirements:
FAI-XYZ Subject
[0.3.x] FAI-XYZ Subject