[ENH] V1 -> V2 Migration - Flows (module)#1609
[ENH] V1 -> V2 Migration - Flows (module)#1609Omswastik-11 wants to merge 280 commits intoopenml:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1609 +/- ##
===========================================
+ Coverage 52.73% 81.47% +28.73%
===========================================
Files 37 61 +24
Lines 4399 5085 +686
===========================================
+ Hits 2320 4143 +1823
+ Misses 2079 942 -1137 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
614411f to
36184e5
Compare
for more information, see https://pre-commit.ci
|
Hi @geetu040 !! Can you review the pre-commit failure It was due to merge conflicts more specifically for tasks . Should I change it on my branch ? |
can you try again, sync your branch with mine? It should be fixed now. |
|
I think that due to conflicts it did not synced properly . I have to revert it manually |
geetu040
left a comment
There was a problem hiding this comment.
Nice overall, few changes needed. I'll look at the tests later when the implementation is final.
openml#1576 (comment) Co-authored-by: Pieter Gijsbers <p.gijsbers@tue.nl>
for more information, see https://pre-commit.ci
…into flow-migration-stacked
This reverts commit 93155ee.
geetu040
left a comment
There was a problem hiding this comment.
update with #1576 (comment)
…into flow-migration-stacked
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 42 out of 43 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def _mocked_perform_api_call(call, request_method): | ||
| url = openml.config.server + "/" + call | ||
| url = openml.config.server + call | ||
| return openml._api_calls._download_text_file(url) |
| @mock.patch.object(requests.Session, "request") | ||
| def test_delete_flow_not_owned(mock_request, test_files_directory, test_apikey_v1): | ||
| openml.config.start_using_configuration_for_example() | ||
| content_file = test_files_directory / "mock_responses" / "flows" / "flow_delete_not_owned.xml" |
| openml.flows.delete_flow(40_000) | ||
|
|
||
| flow_url = f"{openml.config.TEST_SERVER_URL}/api/v1/xml/flow/40000" | ||
| assert flow_url == mock_delete.call_args.args[0] | ||
| assert test_api_key == mock_delete.call_args.kwargs.get("params", {}).get("api_key") | ||
| assert mock_request.call_args.kwargs.get("method") == "DELETE" | ||
| assert test_apikey_v1 == mock_request.call_args.kwargs.get("params", {}).get("api_key") |
| raise ValueError( | ||
| f'invalid api_version="{api_version}" ' | ||
| f"allowed versions: {', '.join(list(APIVersion))}" | ||
| ) | ||
|
|
||
| if fallback_api_version is not None and fallback_api_version not in APIVersion: | ||
| raise ValueError( | ||
| f'invalid fallback_api_version="{fallback_api_version}" ' | ||
| f"allowed versions: {', '.join(list(APIVersion))}" |
| TestBase.logger.info(f"collected from {__file__.split('/')[-1]}: {flow.flow_id}") | ||
|
|
||
|
|
||
| @pytest.mark.sklearn() | ||
| @mock.patch("openml.flows.functions.get_flow") | ||
| @mock.patch("openml.flows.functions.flow_exists") | ||
| @mock.patch("openml._api_calls._perform_api_call") | ||
| def test_publish_error(self, api_call_mock, flow_exists_mock, get_flow_mock): | ||
| @mock.patch("requests.Session.request") | ||
| def test_publish_error(self, mock_request, flow_exists_mock, get_flow_mock): | ||
| model = sklearn.ensemble.RandomForestClassifier() | ||
| flow = self.extension.model_to_flow(model) | ||
| api_call_mock.return_value = ( | ||
|
|
||
| # Create mock response directly |
Fixes #1601
added a
Createmethod inFlowAPIfor publishing flow but not refactored with oldpublish. (Needs discussion on this)Added tests using
fake_methodsso that we can test without localV2server . I have tested theFlowsV2methods (getandexists) anddeleteandlistwere not implemented inV2server so I skipped them .