Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1611 +/- ##
===========================================
+ Coverage 51.66% 79.37% +27.70%
===========================================
Files 63 63
Lines 5551 5565 +14
===========================================
+ Hits 2868 4417 +1549
+ Misses 2683 1148 -1535 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
geetu040
left a comment
There was a problem hiding this comment.
From a high-level review, I noticed a few points that need adjustment:
- Caching can likely be removed from the SDK, since these concerns should be handled by the base client.
- I don't see the
api_contextbeing used intasks/functions, so it's not clear to me how the SDK is actually using the new API interface here. - Instead of moving entire methods out of
tasks/functions.py, it would be better to stick to the goal of minimal SDK changes while enabling v2 support. - API calls should be updated at the specific root functions (for example
_get_task_description,OpenMLTask._download_split). - For listing tasks, please follow the approach discussed in #1575 comment.
geetu040
left a comment
There was a problem hiding this comment.
I have left some comments, please take a look and make sure the signature of all methods in TasksAPI, TasksV1 and TasksV2 stay same.
|
@geetu040 I will explain the confusion I am facing to the best of my abilities, and I do feel communicating on the PR threads is yielding no results, hence I will just put everything here:
I seem to be getting 2 contradictory messages from your end which is where the confusion arises. |
I don't feel confused with the picture I have in my mind, I think I need to explain it even better. I'll try to document each method in detail what should be moved and what should stay. |
|
Kindly resolve the comments which have been solved, it would be easier to navigate! |
It doesn't look like I have the typical "Resolve" button. Edit: It's visible in the "Files changed" section, I'll resolve them there. |
geetu040
left a comment
There was a problem hiding this comment.
Really nice, the code is in a better shape now. Many lines have been removed in the functions.py which seem fine but I'll take a deeper look. In other comments mostly some cleaning is required.
There was a problem hiding this comment.
we have an api call in _download_split, what do you think about that? also does it relate with the datasets PR?
There was a problem hiding this comment.
we have an api call in
_download_split, what do you think about that?
I remember you and Shrivaths discussing cache paths for V1 and V2 and I think the understanding was that the paths would differ, if that is the case, we should change this later on and leave it as it is right now.
also does it relate with the datasets PR?
Only the get_dataset part, hence the Shrivaths comment
There was a problem hiding this comment.
this looks really good and clean now, just one open thread which needs discussion now: #1611 (comment)
There was a problem hiding this comment.
If you agreed with my approach, can we not close that too?
geetu040
left a comment
There was a problem hiding this comment.
sdk code look good so far, please take a look at #1575 (comment) and make changes accordingly where needed.
all tests (existing and new) should pass to make sure we are retaining the original functionality of the sdk
| task_type: TaskType | int | None = None, | ||
| **kwargs: Any, | ||
| ) -> pd.DataFrame: | ||
| raise NotImplementedError("Task listing is not available in API v2 yet.") |
| return tasks | ||
|
|
||
|
|
||
| @openml.utils.thread_safe_if_oslo_installed |
|
|
||
|
|
||
| class OpenMLTask(OpenMLBase): | ||
| class OpenMLTask(OpenMLBase, ResourceAPI): |
There was a problem hiding this comment.
should not inherit ResourceAPI
| source=str(split_url), | ||
| output_path=str(cache_file), | ||
| ) | ||
| self._http.download(url=str(split_url), file_name="datasplits.arff") |
There was a problem hiding this comment.
use api_context.backend.task.[something] here
There was a problem hiding this comment.
How am I supposed to do that? download is a method in the HTTPClient.
There was a problem hiding this comment.
Still this should be under a method now called openml._backend.task.[something] and then we can take this problem to TaskV1.[something].
I see this function depends on download of HTTPClient, I'll either add that method in the core PR or we can plan to merge datasets PR before this.
There was a problem hiding this comment.
Will be moving this to TaskAPI after discussion.
| raise NotImplementedError( | ||
| f"Task type ID {task_type:d} is not supported. " | ||
| f"Supported task type IDs: {TaskType.SUPERVISED_CLASSIFICATION.value}," | ||
| f"{TaskType.SUPERVISED_REGRESSION.value}, " | ||
| f"{TaskType.CLUSTERING.value}, {TaskType.LEARNING_CURVE.value}. " | ||
| f"Please refer to the TaskType enum for valid task type identifiers." | ||
| ) | ||
| raise NotImplementedError(f"Task type {task_type:d} not supported.") |
|
|
||
| return pd.DataFrame.from_dict(tasks, orient="index") | ||
|
|
||
| def _get_estimation_procedure_list(self) -> builtins.list[dict[str, Any]]: |
There was a problem hiding this comment.
@geetu040 We already have implemented this function in the estimation_procedure resource, so I think we don't need it to be here, right?
There was a problem hiding this comment.
Just checked, once we merge your PR we can replace it with the _get_details function yes.
| task_type: TaskType | int | None = None, | ||
| **kwargs: Any, | ||
| ) -> pd.DataFrame: | ||
| raise NotImplementedError(self._not_supported(method="list")) |
There was a problem hiding this comment.
You can just use self._not_supported(method="list")
no need for raise NotImplementedError()
| assert isinstance(procs, list) | ||
| assert len(procs) > 0 | ||
| assert "id" in procs[0] | ||
|
|
There was a problem hiding this comment.
I think you need to add TestTasksV2 class, and also add v1 and v2 matching tests and fallback tests as mentioned here: #1575 (comment)
There was a problem hiding this comment.
I dont need to add TestTasksV2 given those tests are a subset of TestTasksV1. Matching tests are in the shared class.
There was a problem hiding this comment.
you still need TestTasksV2 and check if they raise the not implemented error
i think you should use this design then, since there are many common utilities
tests/test_api/test_versions.py
| task_type: TaskType | int | None = None, | ||
| **kwargs: Any, | ||
| ) -> pd.DataFrame: | ||
| """ |
There was a problem hiding this comment.
@geetu040
Should we all use the same style or not?
for me, I have splitted this this into 3 functions for more readability and less coupling
- list()
- _build_url()
- _parse_list_xml()
There was a problem hiding this comment.
I don't think we need private functions to match each other in terms of nomenclature or functionality as long as we share the same common function names (which we do).
There was a problem hiding this comment.
same nomenclature is preferred
I would say you should do this, will make it better anyways
There was a problem hiding this comment.
Will do, but I don't necessarily agree. Something similar happened in another project where we were working on 2 algorithms and I suggested something similar but Franz mentioned it is not something that can consistently be maintained across the entire codebase hence does not need change. Given we have 8-9 resources it does not feel fruitful to have people share the same nomenclature for private functions across all PRs, I don't have a strong opinion on this though and I will be making the requested change.
There was a problem hiding this comment.
yeah if your function is lengthy then it's always better to break it into components, otherwise agreed this is not necessary
There was a problem hiding this comment.
Oh yeah I agree if the function is lengthy, over here (eman's suggestion) we are just removing 15 lines of code and replacing with 1, hence the hesitance. Anyways, I did change it so the pr is ready for review again :D
geetu040
left a comment
There was a problem hiding this comment.
- rename
taskstotask, inTestTasksV1, `test_tasks.py just for consistency - and other comments from @EmanAbdelhaleem's review
|
@geetu040 you had pushed some commits so I was awaiting instructions on how to proceed next, unless you were picking it up, was my thought. |
I think we discussed but I've made the changes in both datasets and this pr. You can continue if you are willing to work on it. That would require first to fix the tests in the CI by updating tests suits with the moved cache files. |
for more information, see https://pre-commit.ci
geetu040
left a comment
There was a problem hiding this comment.
@satvshr Thanks for the PR and continuing so far. I have made some changes to fix the CI, sycned with main and datasets PR and some left-over comments.
@PGijsbers this is ready for review/merge.
The failing tests in the CI are coming from minio production server which we've discussed in thread and also appear in main tested locally.
Metadata