Skip to content
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

Feature/ai builder connector #408

Merged
merged 26 commits into from
Dec 20, 2024
Merged

Conversation

AdrianAlcolea
Copy link
Collaborator

Change

New connector for the AIBuilder platform

How to Test

There are unitary test created for it.
To test the actual functionality you need to add a valid API_TOKEN (from a user of the platform) to the 'override.env' file and use the 'aibuilder' profile when launching docker compose. Then you will see new ml_models added to the platform (you can search selecting the 'aibuilder' platform).

Checklist

The only thing I didn't do is to add an explanation on the README (in general I see that there are no such explanations for the use of other connectors, but maybe the TOKEN thing should be commented). I guess we can discuss this on the PR and decide if it needs some explanation.

Copy link
Collaborator

@PGijsbers PGijsbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have it working yet (probably misconfigured my API_TOKEN?), so have to try that tomorrow. Here's already some changes though. Assuming it otherwise works I think that's all that really needs to be addressed.

.env Outdated Show resolved Hide resolved
connectors/aibuilder/Dockerfile Outdated Show resolved Hide resolved
Comment on lines 123 to 126
volumes:
- ./src:/app
- ${DATA_PATH}/connectors:/opt/connectors/data
- ./connectors/aibuilder/:/opt/connectors/script
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include the default scripts directly in the image, optionally provide mounted scripts for live updates in the docker-compose.dev.yaml. This makes it so that when running without USE_LOCAL_DEV, you do not accidentally include local changes (provided images were built with a clean slate). Mounting the data directory (for writing logs) can stay, of course. See for example the zenodo connector.

connectors/aibuilder/Dockerfile Show resolved Hide resolved
src/connectors/aibuilder/aibuilder_mlmodel_connector.py Outdated Show resolved Hide resolved
response = requests.get(url, timeout=REQUEST_TIMEOUT)
if not response.ok:
status_code = response.status_code
msg = response.json()["error"]["message"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This errors when the content of the response is not JSON. I found that for the 401: UNAUTHORIZED response, the server does not return JSON, so the connector would crash.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a try - except block returning a record error (it is maybe too generic error for that, but I think it is the proper way in this context to return it)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is not with the request itself (though I guess there can also be errors there). The request is successful but it will have status 401: UNAUTHORIZED and content b'authentication: null' or something similar. The latter is not JSON, so the response.json() call below will result in an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. I took this behaviour from the openml connectors, so maybe we should revise them too. I am looking now at the zenodo one and I will change the approach to that one

@AdrianAlcolea
Copy link
Collaborator Author

I made all the modifications, also added an init method to be able of passing a non-empty TOKEN for the tests.

docker-compose.yaml Outdated Show resolved Hide resolved
@AdrianAlcolea
Copy link
Collaborator Author

I modified the code to handle the responses that are correct but not a 200, added an specific error message for the 401 error and made a new unitary test for it. Also removed the .env file from docker compose.

Copy link
Collaborator

@PGijsbers PGijsbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PGijsbers PGijsbers merged commit 93c4f07 into develop Dec 20, 2024
1 check passed
@PGijsbers PGijsbers deleted the feature/ai_builder_connector branch December 20, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants