Skip to content

Conversation

@kevinmessiaen
Copy link
Member

@kevinmessiaen kevinmessiaen commented Dec 14, 2023

Description

  • Only persist/read cache when explicitly asked
  • Only load artifacts onces per test suite execution (model therefore share cache for a suite)
  • For scan since only one model is loaded cache is also shared

Related Issue

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've read the CODE_OF_CONDUCT.md document.
  • I've read the CONTRIBUTING.md guide.
  • I've updated the code style using make codestyle.
  • I've written tests for all new methods and classes that I created.
  • I've written the docstring in Google format for all the methods and classes that I used.

@linear
Copy link

linear bot commented Dec 14, 2023

@kevinmessiaen kevinmessiaen marked this pull request as ready for review December 14, 2023 15:46
@kevinmessiaen kevinmessiaen requested review from Hartorn, Inokinoki, andreybavt and mattbit and removed request for Hartorn and mattbit December 14, 2023 15:47
…el-cache-button-in-the-hub' into feature/gsk-2378-add-a-clear-model-cache-button-in-the-hub
) -> websocket.TestSuite:
log_listener = LogListener()

loaded_artifacts = dict()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it initialized here if it's also set in the function with the 'if none' condition ?

Copy link
Member

Choose a reason for hiding this comment

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

it' done to share the cache between the global arguments and test ones

Copy link
Member

@Hartorn Hartorn left a comment

Choose a reason for hiding this comment

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

Looks good, some small comment.
Did not test , and just looked quickly

def parse_function_arguments(client: Optional[GiskardClient], request_arguments: List[websocket.FuncArgument]):
def _get_or_load(loaded_artifacts: Dict[str, Dict[str, Any]], type: str, uuid: str, load_fn: Callable[[], Any]) -> Any:
if type not in loaded_artifacts:
loaded_artifacts[type] = dict()
Copy link
Member

Choose a reason for hiding this comment

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

This could be avoided by giving a defaultdict instead of a dict, with dict as default factory

) -> websocket.TestSuite:
log_listener = LogListener()

loaded_artifacts = dict()
Copy link
Member

Choose a reason for hiding this comment

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

it' done to share the cache between the global arguments and test ones

cache_dir = self._default_cache_dir_prefix.joinpath(self.id)
if persist_cache:
if cache_dir is None and self.id:
cache_dir = self._default_cache_dir_prefix.joinpath(self.id)
Copy link
Member

Choose a reason for hiding this comment

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

Could be self._default_cache_dir_prefix / self.id

@Hartorn Hartorn changed the title Only persist/read cache when explicitly asked [GSK-2378] Only persist/read cache when explicitly asked Dec 18, 2023
@Hartorn Hartorn enabled auto-merge (squash) December 18, 2023 10:28
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

3 New issues
0 Security Hotspots
95.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@Hartorn Hartorn merged commit 74ec47e into main Dec 18, 2023
@Hartorn Hartorn deleted the feature/gsk-2378-add-a-clear-model-cache-button-in-the-hub branch December 18, 2023 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants