Skip to content

Commit

Permalink
[HWORKS-798] Add **kwargs to python client libraries (logicalclocks#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
robzor92 authored Oct 18, 2023
1 parent 784b0b5 commit eee4f5b
Show file tree
Hide file tree
Showing 24 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
1 change: 1 addition & 0 deletions python/hsml/deployable_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
script_file: Optional[str] = None,
resources: Optional[Resources] = None,
inference_batcher: Optional[Union[InferenceBatcher, dict]] = None,
**kwargs,
):
self._script_file = script_file
self._resources = resources
Expand Down
2 changes: 1 addition & 1 deletion python/hsml/deployable_component_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DeployableComponentLogs:
`DeployableComponentLogs`. Server logs of a deployable component
"""

def __init__(self, instance_name: str, content: str):
def __init__(self, instance_name: str, content: str, **kwargs):
self._instance_name = instance_name
self._content = content
self._created_at = datetime.now()
Expand Down
6 changes: 5 additions & 1 deletion python/hsml/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class Deployment:
"""Metadata object representing a deployment in Model Serving."""

def __init__(
self, predictor, name: Optional[str] = None, description: Optional[str] = None
self,
predictor,
name: Optional[str] = None,
description: Optional[str] = None,
**kwargs,
):
self._predictor = predictor
self._description = description
Expand Down
1 change: 1 addition & 0 deletions python/hsml/inference_batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
max_batch_size: Optional[int] = None,
max_latency: Optional[int] = None,
timeout: Optional[int] = None,
**kwargs,
):
self._enabled = enabled if enabled is not None else INFERENCE_BATCHER.ENABLED
self._max_batch_size = max_batch_size if max_batch_size is not None else None
Expand Down
2 changes: 1 addition & 1 deletion python/hsml/inference_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class InferenceEndpointPort:
`InferenceEndpointPort`. Port of an inference endpoint.
"""

def __init__(self, name: str, number: int):
def __init__(self, name: str, number: int, **kwargs):
self._name = name
self._number = number

Expand Down
1 change: 1 addition & 0 deletions python/hsml/inference_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
self,
kafka_topic: Optional[Union[KafkaTopic, dict]] = DEFAULT,
mode: Optional[str] = INFERENCE_LOGGER.MODE_ALL,
**kwargs,
):
self._kafka_topic = util.get_obj_from_json(kafka_topic, KafkaTopic)
self._mode = self._validate_mode(mode) or (
Expand Down
1 change: 1 addition & 0 deletions python/hsml/kafka_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
name: str = KAFKA_TOPIC.CREATE,
num_replicas: Optional[int] = None,
num_partitions: Optional[int] = None,
**kwargs,
):
self._name = name
self._num_replicas, self._num_partitions = self._validate_topic_config(
Expand Down
1 change: 1 addition & 0 deletions python/hsml/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(
input_example=None,
framework=None,
model_registry_id=None,
**kwargs,
):
self._id = id
self._name = name
Expand Down
1 change: 1 addition & 0 deletions python/hsml/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(
project_id,
model_registry_id,
shared_registry_project_name=None,
**kwargs,
):
self._project_name = project_name
self._project_id = project_id
Expand Down
1 change: 1 addition & 0 deletions python/hsml/model_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(
self,
input_schema: Optional[Schema] = None,
output_schema: Optional[Schema] = None,
**kwargs,
):
if input_schema is not None:
self.input_schema = input_schema
Expand Down
7 changes: 6 additions & 1 deletion python/hsml/model_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
class ModelServing:
DEFAULT_VERSION = 1

def __init__(self, project_name: str, project_id: int):
def __init__(
self,
project_name: str,
project_id: int,
**kwargs,
):
self._project_name = project_name
self._project_id = project_id

Expand Down
1 change: 1 addition & 0 deletions python/hsml/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(
description: Optional[str] = None,
created_at: Optional[str] = None,
creator: Optional[str] = None,
**kwargs,
):
serving_tool = (
self._validate_serving_tool(serving_tool)
Expand Down
1 change: 1 addition & 0 deletions python/hsml/predictor_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(
deployed: Optional[bool],
condition: Optional[PredictorStateCondition],
status: str,
**kwargs,
):
self._available_predictor_instances = available_predictor_instances
self._available_transformer_instances = available_transformer_instances
Expand Down
1 change: 1 addition & 0 deletions python/hsml/predictor_state_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(
type: str,
status: Optional[bool] = None,
reason: Optional[str] = None,
**kwargs,
):
self._type = type
self._status = status
Expand Down
1 change: 1 addition & 0 deletions python/hsml/python/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
**kwargs,
):
super().__init__(
id,
Expand Down
1 change: 1 addition & 0 deletions python/hsml/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
cores: int,
memory: int,
gpus: int,
**kwargs,
):
self._cores = cores
self._memory = memory
Expand Down
1 change: 1 addition & 0 deletions python/hsml/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(
list,
]
] = None,
**kwargs,
):
# A tensor schema is either ndarray of a list containing name, type and shape dicts
if isinstance(object, numpy.ndarray) or (
Expand Down
1 change: 1 addition & 0 deletions python/hsml/sklearn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
**kwargs,
):
super().__init__(
id,
Expand Down
1 change: 1 addition & 0 deletions python/hsml/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(
items=None,
count=None,
type=None,
**kwargs,
):
self._name = name
self._value = value
Expand Down
1 change: 1 addition & 0 deletions python/hsml/tensorflow/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
**kwargs,
):
super().__init__(
id,
Expand Down
1 change: 1 addition & 0 deletions python/hsml/torch/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
**kwargs,
):
super().__init__(
id,
Expand Down
1 change: 1 addition & 0 deletions python/hsml/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(
self,
script_file: str,
resources: Optional[Union[TransformerResources, dict]] = None, # base
**kwargs,
):
resources = (
self._validate_resources(
Expand Down
9 changes: 3 additions & 6 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ def read(fname):
"numpy",
"pyjks",
"mock",
"tqdm"
"tqdm",
],
extras_require={
"dev": [
"pytest",
"flake8",
"black"],
"dev": ["pytest", "flake8", "black"],
"docs": [
"mkdocs==1.3.0",
"mkdocs-material==8.2.8",
Expand All @@ -56,7 +53,7 @@ def read(fname):
"markdown-include",
"markdown==3.3.7",
"pymdown-extensions",
]
],
},
author="Logical Clocks AB",
author_email="[email protected]",
Expand Down

0 comments on commit eee4f5b

Please sign in to comment.