-
-
Notifications
You must be signed in to change notification settings - Fork 465
GSK-2887 Upload tests with project when uploading a suite #1837
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ce94397
GSK-2887 Upload tests with project when uploading a suite
kevinmessiaen 2a14d75
GSK-2887 Upload tests with project when uploading a suite
kevinmessiaen a9e4798
Merge branch 'multi-ml-worker' into GSK-2887
kevinmessiaen 31ebdbb
GSK-2887 Fixed tests
kevinmessiaen fb74cfd
GSK-2887 Fixed tests
kevinmessiaen 140b9a1
GSK-2887 Fixed tests
kevinmessiaen 253b067
GSK-2887 Comment clean up
kevinmessiaen 7709a4c
GSK-2887 Removing client dependency
kevinmessiaen 0941113
GSK-2887 Removed local tests
kevinmessiaen 5355832
Merge branch 'multi-ml-worker' into GSK-2887
kevinmessiaen c88c206
Merge branch 'multi-ml-worker' into GSK-2887
Hartorn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -430,12 +430,10 @@ def head_slice(df: pd.DataFrame) -> pd.DataFrame: | |
|
|
||
|
|
||
| # FIXME: Internal worker cannot yet load callable due to yaml deserialization issue | ||
| @pytest.mark.parametrize("callable_under_project", [False, True]) | ||
| def test_websocket_actor_dataset_processing_head_slicing_with_cache(callable_under_project, request): | ||
| def test_websocket_actor_dataset_processing_head_slicing_with_cache(request): | ||
| dataset: Dataset = request.getfixturevalue("enron_data") | ||
|
|
||
| project_key = str(uuid.uuid4()) # Use a UUID to separate the resources used by the tests | ||
| callable_function_project_key = project_key if callable_under_project else None | ||
|
|
||
| with utils.MockedProjectCacheDir(): | ||
| # Prepare dataset | ||
|
|
@@ -448,7 +446,7 @@ def test_websocket_actor_dataset_processing_head_slicing_with_cache(callable_und | |
| functions=[ | ||
| websocket.DatasetProcessingFunction( | ||
| slicingFunction=websocket.ArtifactRef( | ||
| project_key=callable_function_project_key, | ||
| project_key=project_key, | ||
| id=head_slice.meta.uuid, | ||
| ) | ||
| ) | ||
|
|
@@ -458,8 +456,8 @@ def test_websocket_actor_dataset_processing_head_slicing_with_cache(callable_und | |
| # Prepare URL for meta info | ||
| cf = head_slice | ||
| # The slicing function will be loaded from the current module, without further requests | ||
| utils.register_uri_for_artifact_meta_info(mr, cf, project_key=callable_function_project_key) | ||
| utils.register_uri_for_artifact_info(mr, cf, project_key=callable_function_project_key) | ||
| utils.register_uri_for_artifact_meta_info(mr, cf, project_key=project_key) | ||
| utils.register_uri_for_artifact_info(mr, cf, project_key=project_key) | ||
|
|
||
| # The dataset can be then loaded from the cache, without further requests | ||
| utils.register_uri_for_dataset_meta_info(mr, dataset, project_key) | ||
|
|
@@ -481,16 +479,14 @@ def do_nothing(row): | |
|
|
||
|
|
||
| # FIXME: Internal worker cannot yet load callable due to yaml deserialization issue | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idem. |
||
| @pytest.mark.parametrize("callable_under_project", [False, True]) | ||
| def test_websocket_actor_dataset_processing_do_nothing_transform_with_cache(callable_under_project, request): | ||
| def test_websocket_actor_dataset_processing_do_nothing_transform_with_cache(request): | ||
| dataset: Dataset = request.getfixturevalue("enron_data") | ||
|
|
||
| project_key = str(uuid.uuid4()) # Use a UUID to separate the resources used by the tests | ||
|
|
||
| with utils.MockedProjectCacheDir(): | ||
| # Prepare dataset | ||
| utils.local_save_dataset_under_giskard_home_cache(dataset) | ||
| callable_function_project_key = project_key if callable_under_project else None | ||
|
|
||
| do_nothing.meta.uuid = str(uuid.uuid4()) | ||
|
|
||
|
|
@@ -499,7 +495,7 @@ def test_websocket_actor_dataset_processing_do_nothing_transform_with_cache(call | |
| functions=[ | ||
| websocket.DatasetProcessingFunction( | ||
| transformationFunction=websocket.ArtifactRef( | ||
| project_key=callable_function_project_key, | ||
| project_key=project_key, | ||
| id=do_nothing.meta.uuid, | ||
| ) | ||
| ) | ||
|
|
@@ -509,8 +505,8 @@ def test_websocket_actor_dataset_processing_do_nothing_transform_with_cache(call | |
| # Prepare URL for meta info | ||
| cf = do_nothing | ||
| # The slicing function will be loaded from the current module, without further requests | ||
| utils.register_uri_for_artifact_meta_info(mr, cf, project_key=callable_function_project_key) | ||
| utils.register_uri_for_artifact_info(mr, cf, project_key=callable_function_project_key) | ||
| utils.register_uri_for_artifact_meta_info(mr, cf, project_key=project_key) | ||
| utils.register_uri_for_artifact_info(mr, cf, project_key=project_key) | ||
|
|
||
| # The dataset can be then loaded from the cache, without further requests | ||
| utils.register_uri_for_dataset_meta_info(mr, dataset, project_key) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| ) | ||
|
|
||
| BASE_CLIENT_URL = "http://giskard-host:12345/api/v2" | ||
| PROJECT_KEY = "project_key" | ||
|
|
||
|
|
||
| # Define a test function | ||
|
|
@@ -109,12 +110,12 @@ def test_download_callable_function(cf: Artifact): | |
| "name": f"fake_{cf._get_name()}", | ||
| } | ||
| ) | ||
| url = get_url_for_artifact_meta_info(cf, project_key=None) | ||
| url = get_url_for_artifact_meta_info(cf, PROJECT_KEY) | ||
| mr.register_uri(method=requests_mock.GET, url=url, json=meta_info) | ||
| requested_urls.append(url) | ||
|
|
||
| # Register for Artifact info | ||
| requested_urls.extend(register_uri_for_artifact_info(mr, cf, project_key=None)) | ||
| requested_urls.extend(register_uri_for_artifact_info(mr, cf, PROJECT_KEY)) | ||
|
|
||
| # Register for Artifacts content | ||
| artifacts_base_url = get_url_for_artifacts_base(cf) | ||
|
|
@@ -128,7 +129,7 @@ def test_download_callable_function(cf: Artifact): | |
| requested_urls.append(posixpath.join(artifacts_base_url, file)) | ||
|
|
||
| # Download: should not call load_artifact to request and download | ||
| download_cf = cf.__class__.download(uuid=cf.meta.uuid, client=client, project_key=None) | ||
| download_cf = cf.__class__.download(uuid=cf.meta.uuid, client=client, project_key=PROJECT_KEY) | ||
|
|
||
| for requested_url in requested_urls: | ||
| assert is_url_requested(mr.request_history, requested_url) | ||
|
|
@@ -149,17 +150,17 @@ def test_download_callable_function(cf: Artifact): | |
| do_nothing, # Transformation | ||
| ], | ||
| ) | ||
| def test_download_global_callable_function_from_module(cf: Artifact): | ||
| def test_download_callable_function_from_module(cf: Artifact): | ||
| with MockedClient(mock_all=False) as (client, mr): | ||
| cf.meta.uuid = str(uuid.uuid4()) # Regenerate a UUID to ensure not loading from registry | ||
| cache_dir = get_local_cache_callable_artifact(artifact=cf) | ||
|
|
||
| requested_urls = [] | ||
| # Prepare global URL | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be changed to prepare URLs, cuz we have no more global artefacts |
||
| requested_urls.extend(register_uri_for_artifact_meta_info(mr, cf, project_key=None)) | ||
| requested_urls.extend(register_uri_for_artifact_meta_info(mr, cf, project_key=PROJECT_KEY)) | ||
|
|
||
| # Download: should not call load_artifact to request and download | ||
| download_cf = cf.__class__.download(uuid=cf.meta.uuid, client=client, project_key=None) | ||
| download_cf = cf.__class__.download(uuid=cf.meta.uuid, client=client, project_key=PROJECT_KEY) | ||
|
|
||
| for requested_url in requested_urls: | ||
| assert is_url_requested(mr.request_history, requested_url) | ||
|
|
@@ -180,7 +181,7 @@ def test_download_global_callable_function_from_module(cf: Artifact): | |
| do_nothing, # Transformation | ||
| ], | ||
| ) | ||
| def test_download_global_callable_function_from_cache(cf: Artifact): | ||
| def test_download_callable_function_from_cache(cf: Artifact): | ||
| with MockedClient(mock_all=False) as (client, mr): | ||
| cf.meta.uuid = str(uuid.uuid4()) # Regenerate a UUID | ||
| cache_dir = get_local_cache_callable_artifact(artifact=cf) | ||
|
|
@@ -190,10 +191,10 @@ def test_download_global_callable_function_from_cache(cf: Artifact): | |
| assert (cache_dir / CALLABLE_FUNCTION_PKL_CACHE).exists() | ||
| assert (cache_dir / CALLABLE_FUNCTION_META_CACHE).exists() | ||
|
|
||
| requested_urls = register_uri_for_artifact_meta_info(mr, cf, project_key=None) | ||
| requested_urls = register_uri_for_artifact_meta_info(mr, cf, project_key=PROJECT_KEY) | ||
|
|
||
| # Download: should not call load_artifact to request and download | ||
| download_cf = cf.__class__.download(uuid=cf.meta.uuid, client=client, project_key=None) | ||
| download_cf = cf.__class__.download(uuid=cf.meta.uuid, client=client, project_key=PROJECT_KEY) | ||
|
|
||
| for requested_url in requested_urls: | ||
| assert is_url_requested(mr.request_history, requested_url) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We can remove this line