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

vdk-core: add memory properties client #921

Merged
merged 4 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ def read_properties(self, job_name: str, team_name: str) -> Dict:
return res

def write_properties(self, job_name: str, team_name: str, properties: Dict) -> Dict:
log.warning(
"You are using In Memory Properties client. "
antoniivanov marked this conversation as resolved.
Show resolved Hide resolved
"That means the properties will not be persisted past the Data Job run."
)
self._props = deepcopy(properties)
return self._props
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
from src.vdk.internal.builtin_plugins.job_properties.inmemproperties import (
antoniivanov marked this conversation as resolved.
Show resolved Hide resolved
InMemPropertiesServiceClient,
)
from vdk.api.plugin.hook_markers import hookimpl
from vdk.internal.builtin_plugins.job_properties import properties_config
from vdk.internal.builtin_plugins.run.job_context import JobContext
from vdk.internal.core.config import ConfigurationBuilder


Expand All @@ -13,3 +17,9 @@ class PropertiesApiPlugin:
@hookimpl(tryfirst=True)
def vdk_configure(self, config_builder: ConfigurationBuilder) -> None:
properties_config.add_definitions(config_builder)

@hookimpl
def initialize_job(self, context: JobContext) -> None:
context.properties.set_properties_factory_method(
"memory", lambda: InMemPropertiesServiceClient()
)