frogml-core 0.0.96__py3-none-any.whl → 0.0.98__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. frogml_core/__init__.py +1 -1
  2. frogml_core/clients/batch_job_management/client.py +39 -0
  3. frogml_core/clients/instance_template/client.py +6 -4
  4. frogml_core/clients/model_version_manager/client.py +4 -4
  5. frogml_core/clients/prompt_manager/model_descriptor_mapper.py +4 -4
  6. frogml_core/feature_store/_common/artifact_utils.py +3 -3
  7. frogml_core/feature_store/data_sources/batch/athena.py +3 -3
  8. frogml_core/feature_store/feature_sets/context.py +2 -6
  9. frogml_core/feature_store/feature_sets/streaming.py +3 -3
  10. frogml_core/feature_store/feature_sets/streaming_backfill.py +1 -1
  11. frogml_core/feature_store/online/client.py +6 -6
  12. frogml_core/feature_store/sinks/streaming/factory.py +1 -1
  13. frogml_core/inner/build_logic/phases/phase_010_fetch_model/fetch_strategy_manager/strategy/git/git_strategy.py +3 -3
  14. frogml_core/inner/di_configuration/account.py +2 -2
  15. frogml_core/inner/tool/auth.py +2 -3
  16. frogml_core/llmops/provider/openai/provider.py +3 -3
  17. frogml_core/model/tools/adapters/output.py +1 -1
  18. frogml_core/tools/logger/logger.py +1 -1
  19. frogml_core/utils/proto_utils.py +1 -1
  20. frogml_core-0.0.98.dist-info/METADATA +411 -0
  21. {frogml_core-0.0.96.dist-info → frogml_core-0.0.98.dist-info}/RECORD +62 -24
  22. frogml_services_mock/mocks/batch_job_manager_service.py +23 -0
  23. frogml_storage/__init__.py +1 -0
  24. frogml_storage/_environment.py +22 -0
  25. frogml_storage/artifactory/__init__.py +1 -0
  26. frogml_storage/artifactory/_artifactory_api.py +315 -0
  27. frogml_storage/authentication/login/__init__.py +1 -0
  28. frogml_storage/authentication/login/_login_cli.py +229 -0
  29. frogml_storage/authentication/login/_login_command.py +71 -0
  30. frogml_storage/authentication/models/__init__.py +3 -0
  31. frogml_storage/authentication/models/_auth.py +20 -0
  32. frogml_storage/authentication/models/_auth_config.py +70 -0
  33. frogml_storage/authentication/models/_login.py +22 -0
  34. frogml_storage/authentication/utils/__init__.py +17 -0
  35. frogml_storage/authentication/utils/_authentication_utils.py +281 -0
  36. frogml_storage/authentication/utils/_login_checks_utils.py +114 -0
  37. frogml_storage/base_storage.py +140 -0
  38. frogml_storage/constants.py +56 -0
  39. frogml_storage/exceptions/checksum_verification_error.py +3 -0
  40. frogml_storage/exceptions/validation_error.py +4 -0
  41. frogml_storage/frog_ml.py +668 -0
  42. frogml_storage/http/__init__.py +1 -0
  43. frogml_storage/http/http_client.py +83 -0
  44. frogml_storage/logging/__init__.py +1 -0
  45. frogml_storage/logging/_log_config.py +45 -0
  46. frogml_storage/logging/log_utils.py +21 -0
  47. frogml_storage/models/__init__.py +1 -0
  48. frogml_storage/models/_download_context.py +54 -0
  49. frogml_storage/models/dataset_manifest.py +13 -0
  50. frogml_storage/models/entity_manifest.py +93 -0
  51. frogml_storage/models/frogml_dataset_version.py +21 -0
  52. frogml_storage/models/frogml_entity_type_info.py +48 -0
  53. frogml_storage/models/frogml_entity_version.py +34 -0
  54. frogml_storage/models/frogml_model_version.py +21 -0
  55. frogml_storage/models/model_manifest.py +60 -0
  56. frogml_storage/models/serialization_metadata.py +15 -0
  57. frogml_storage/utils/__init__.py +12 -0
  58. frogml_storage/utils/_input_checks_utility.py +104 -0
  59. frogml_storage/utils/_storage_utils.py +15 -0
  60. frogml_storage/utils/_url_utils.py +27 -0
  61. frogml_core-0.0.96.dist-info/METADATA +0 -46
  62. {frogml_core-0.0.96.dist-info → frogml_core-0.0.98.dist-info}/WHEEL +0 -0
  63. {frogml_proto → frogml_storage/authentication}/__init__.py +0 -0
frogml_core/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Top-level package for frogml."""
2
2
 
3
3
  __author__ = "jfrog"
4
- __version__ = "0.0.96"
4
+ __version__ = "0.0.98"
5
5
 
6
6
  from frogml_core.inner.di_configuration import wire_dependencies
7
7
  from frogml_core.model.model_version_tracking import ( # noqa: F401,E501
@@ -36,6 +36,10 @@ from frogml_proto.qwak.batch_job.v1.batch_job_service_pb2 import (
36
36
  StartBatchJobResponse,
37
37
  StartWarmupJobRequest,
38
38
  StartWarmupJobResponse,
39
+ UpdateTasksDetailsResponse,
40
+ UpdateTasksDetailsRequest,
41
+ BatchTaskDetails,
42
+ InputFileDetails,
39
43
  )
40
44
  from frogml_proto.qwak.batch_job.v1.batch_job_service_pb2_grpc import (
41
45
  BatchJobManagementServiceStub,
@@ -67,6 +71,7 @@ from .results import (
67
71
  GetExecutionReportResult,
68
72
  StartExecutionResult,
69
73
  )
74
+ from typing import List
70
75
 
71
76
  CLIENT_TIMEOUT = 180 # Seconds
72
77
 
@@ -542,3 +547,37 @@ class BatchJobManagerClient:
542
547
 
543
548
  except grpc.RpcError as e:
544
549
  raise FrogmlException(f"Failed to get batch job details, error is: {e}")
550
+
551
+ def update_task_details(self, task_id: str, input_file_paths: List[str]):
552
+ """
553
+ Update task details for a specific task using the provided list of input file paths.
554
+
555
+ Args:
556
+ task_id: The ID of the task to update.
557
+ input_file_paths: A list of paths for the input files associated with the task.
558
+ """
559
+ # Create InputFileDetails messages for each input file path
560
+ input_files_details = [
561
+ InputFileDetails(path=file_path) for file_path in input_file_paths
562
+ ]
563
+
564
+ # Create BatchTaskDetails message for the single task
565
+ batch_task_details = BatchTaskDetails(
566
+ task_id=task_id, input_files_details=input_files_details
567
+ )
568
+
569
+ update_request = UpdateTasksDetailsRequest(
570
+ tasks_details=[batch_task_details] # Wrap in a list
571
+ )
572
+
573
+ try:
574
+ response: UpdateTasksDetailsResponse = (
575
+ self.batch_job_management.UpdateTasksDetails(
576
+ update_request, timeout=CLIENT_TIMEOUT
577
+ )
578
+ )
579
+ return response
580
+ except grpc.RpcError as e:
581
+ raise FrogmlException(
582
+ f"Failed to update task details for task '{task_id}', error is: {e}"
583
+ )
@@ -50,10 +50,12 @@ class InstanceTemplateManagementClient:
50
50
 
51
51
  def list_instance_templates(self) -> List[InstanceTemplateSpec]:
52
52
  try:
53
- result: ListInstanceTemplatesResponse = self._instance_template_service.ListInstanceTemplates(
54
- ListInstanceTemplatesRequest(
55
- optional_instance_filter=InstanceFilter(
56
- instance_type_filter=InstanceTypeFilter.INSTANCE_TYPE_FILTER_ALL
53
+ result: ListInstanceTemplatesResponse = (
54
+ self._instance_template_service.ListInstanceTemplates(
55
+ ListInstanceTemplatesRequest(
56
+ optional_instance_filter=InstanceFilter(
57
+ instance_type_filter=InstanceTypeFilter.INSTANCE_TYPE_FILTER_ALL
58
+ )
57
59
  )
58
60
  )
59
61
  )
@@ -2,7 +2,7 @@ from platform import python_version
2
2
  from typing import List, Optional, Dict, Union, Tuple
3
3
 
4
4
  from dependency_injector.wiring import Provide
5
- from frogml_storage.entity_manifest import Artifact
5
+ from frogml_storage.models.entity_manifest import Artifact
6
6
  from grpc import RpcError
7
7
 
8
8
  from frogml_core.exceptions import FrogmlException
@@ -210,9 +210,9 @@ class ModelVersionManagerClient:
210
210
  Optional[List[ArtifactProto]],
211
211
  List[ArtifactProto],
212
212
  ]:
213
- model_artifact_proto: List[
214
- ArtifactProto
215
- ] = ProtoUtils.convert_artifacts_to_artifacts_proto(model_artifact)
213
+ model_artifact_proto: List[ArtifactProto] = (
214
+ ProtoUtils.convert_artifacts_to_artifacts_proto(model_artifact)
215
+ )
216
216
  dependency_artifacts_proto = (
217
217
  ProtoUtils.convert_artifacts_to_artifacts_proto(dependency_artifacts)
218
218
  if dependency_artifacts
@@ -57,10 +57,10 @@ class ModelDescriptorMapper:
57
57
  model_id: str, openai_chat_params: ProtoOpenAIChatModelParams
58
58
  ) -> OpenAIChat:
59
59
  p = openai_chat_params
60
- _tool_choice: Union[
61
- str, ChatCompletionNamedToolChoiceParam
62
- ] = ModelDescriptorMapper._from_tool_choice(
63
- openai_chat_params=openai_chat_params
60
+ _tool_choice: Union[str, ChatCompletionNamedToolChoiceParam] = (
61
+ ModelDescriptorMapper._from_tool_choice(
62
+ openai_chat_params=openai_chat_params
63
+ )
64
64
  )
65
65
  _tools: List[ChatCompletionToolParam] = []
66
66
 
@@ -45,9 +45,9 @@ class ArtifactsUploader:
45
45
  featureset_name: str,
46
46
  __instance_module_path__: str,
47
47
  ) -> Optional[ArtifactSpec]:
48
- transformation_functions: Optional[
49
- List[Callable[..., Any]]
50
- ] = transformation.get_functions()
48
+ transformation_functions: Optional[List[Callable[..., Any]]] = (
49
+ transformation.get_functions()
50
+ )
51
51
  if transformation_functions is not None and transformation_functions:
52
52
  return ArtifactSpec(
53
53
  artifact_name=featureset_name,
@@ -130,9 +130,9 @@ class AthenaSource(JdbcSource):
130
130
  )
131
131
  )
132
132
 
133
- time_partition_columns: Optional[
134
- TimePartitionColumns
135
- ] = AthenaSource._extract_partition_column(proto_athena_source)
133
+ time_partition_columns: Optional[TimePartitionColumns] = (
134
+ AthenaSource._extract_partition_column(proto_athena_source)
135
+ )
136
136
  workgroup: Optional[str] = (
137
137
  proto_athena_source.workgroup
138
138
  if proto_athena_source.HasField("workgroup")
@@ -5,9 +5,5 @@ from typing import Union
5
5
 
6
6
  @dataclass
7
7
  class Context:
8
- start_time: Union[
9
- str, datetime
10
- ] = "${qwak_ingestion_start_timestamp}" # todo mlops-2312 - rename?
11
- end_time: Union[
12
- str, datetime
13
- ] = "${qwak_ingestion_end_timestamp}" # todo mlops-2312 - rename?
8
+ start_time: Union[str, datetime] = "${qwak_ingestion_start_timestamp}"
9
+ end_time: Union[str, datetime] = "${qwak_ingestion_end_timestamp}"
@@ -131,9 +131,9 @@ def feature_set(
131
131
  offline_scheduling_policy=offline_scheduling_policy,
132
132
  )
133
133
 
134
- streaming_backfill: Optional[
135
- StreamingBackfill
136
- ] = StreamingBackfill.get_streaming_backfill_from_function(function=function)
134
+ streaming_backfill: Optional[StreamingBackfill] = (
135
+ StreamingBackfill.get_streaming_backfill_from_function(function=function)
136
+ )
137
137
 
138
138
  fs_name = name or function.__name__
139
139
  streaming_feature_set = StreamingFeatureSet(
@@ -230,7 +230,7 @@ class StreamingBackfill:
230
230
 
231
231
  @staticmethod
232
232
  def _get_normalized_backfill_sources_spec(
233
- data_sources: Union[List[str], List[DataSourceBackfillSpec]]
233
+ data_sources: Union[List[str], List[DataSourceBackfillSpec]],
234
234
  ) -> List[DataSourceBackfillSpec]:
235
235
  # reformat all data source specs to 'DataSourceBackfillSpec'
236
236
  return [
@@ -197,12 +197,12 @@ class OnlineClient:
197
197
  )
198
198
  ordered_entities = [entity[0] for entity in ordered_entities_tuple]
199
199
 
200
- request_chunks: List[
201
- Tuple[RequestedEntitiesMatrix, pd.DataFrame]
202
- ] = OnlineClient._split_entities(
203
- entity_names=ordered_entities,
204
- population_df=df,
205
- max_entities_per_split=max_keys_per_request,
200
+ request_chunks: List[Tuple[RequestedEntitiesMatrix, pd.DataFrame]] = (
201
+ OnlineClient._split_entities(
202
+ entity_names=ordered_entities,
203
+ population_df=df,
204
+ max_entities_per_split=max_keys_per_request,
205
+ )
206
206
  )
207
207
 
208
208
  results: List[pd.DataFrame] = []
@@ -25,7 +25,7 @@ class StreamingSinkFactory:
25
25
  def get_streaming_sink(proto_streaming_sink: ProtoStreamingSink) -> BaseSink:
26
26
  sink_type = proto_streaming_sink.WhichOneof("sink_type")
27
27
 
28
- auth_conf: BaseAuthentication
28
+ auth_conf: BaseAuthentication # noqa: F842
29
29
  if sink_type == "kafka_sink":
30
30
  proto_kafka_sink: ProtoKafkaSink = proto_streaming_sink.kafka_sink
31
31
  auth_configuration: BaseAuthentication = cast(
@@ -161,9 +161,9 @@ def make_ssh_key_file(git_ssh_key: str) -> str:
161
161
 
162
162
 
163
163
  def add_ssh_file_to_env(ssh_key_file_path: str) -> None:
164
- os.environ[
165
- "GIT_SSH_COMMAND"
166
- ] = f"ssh -i {ssh_key_file_path} -o StrictHostKeyChecking=no"
164
+ os.environ["GIT_SSH_COMMAND"] = (
165
+ f"ssh -i {ssh_key_file_path} -o StrictHostKeyChecking=no"
166
+ )
167
167
  os.environ["GIT_SSH"] = f"ssh -i {ssh_key_file_path} -o StrictHostKeyChecking=no"
168
168
 
169
169
 
@@ -3,8 +3,8 @@ import os
3
3
  from dataclasses import dataclass
4
4
  from typing import Optional
5
5
 
6
- from frogml_storage.authentication._authentication_utils import get_credentials
7
- from frogml_storage.cli._login_cli import login as frogml_login
6
+ from frogml_storage.authentication.utils import get_credentials
7
+ from frogml_storage.authentication.login import frogml_login
8
8
  from frogml_storage.constants import CONFIG_FILE_PATH
9
9
 
10
10
  from frogml_core.exceptions import FrogmlLoginException
@@ -1,9 +1,8 @@
1
1
  from typing import Optional, Union, cast
2
2
 
3
3
  import requests
4
- from frogml_storage._utils import BearerAuth
5
- from frogml_storage.authentication._authentication_utils import get_credentials
6
- from frogml_storage.authentication.models._auth_config import AuthConfig
4
+ from frogml_storage.authentication.models import AuthConfig, BearerAuth
5
+ from frogml_storage.authentication.utils import get_credentials
7
6
  from requests.auth import AuthBase
8
7
  from typing_extensions import Self
9
8
 
@@ -30,9 +30,9 @@ class OpenAIProvider:
30
30
  self.client = OpenAIClient()
31
31
 
32
32
  def _get_random_openai_api_key(self) -> Optional[str]:
33
- openai_api_keys: List[
34
- OpenAIApiKeySystemSecret
35
- ] = IntegrationUtils().get_openai_api_keys()
33
+ openai_api_keys: List[OpenAIApiKeySystemSecret] = (
34
+ IntegrationUtils().get_openai_api_keys()
35
+ )
36
36
  if len(openai_api_keys) == 0:
37
37
  return None
38
38
 
@@ -46,7 +46,7 @@ def get_output_adapter(
46
46
 
47
47
  first_result = (
48
48
  return_result[0]
49
- if type(return_result) == list and len(return_result) > 0
49
+ if isinstance(return_result, list) and len(return_result) > 0
50
50
  else return_result
51
51
  )
52
52
  if issubclass(type(first_result), Message):
@@ -276,7 +276,7 @@ def set_file_handler_log_file(
276
276
  logger: logging.Logger, handler_name: str, log_file: Path
277
277
  ):
278
278
  existing_handler = get_handler_from_logger(logger, handler_name)
279
- if type(existing_handler) != RotatingFileHandler:
279
+ if not isinstance(existing_handler, RotatingFileHandler):
280
280
  raise FrogmlException(
281
281
  f"Error in setting log file. Error message: handler of name {handler_name} is not a file logger handler"
282
282
  )
@@ -1,6 +1,6 @@
1
1
  from typing import List
2
2
 
3
- from frogml_storage.entity_manifest import Artifact
3
+ from frogml_storage.models.entity_manifest import Artifact
4
4
 
5
5
  from frogml_proto.jfml.model_version.v1.artifact_pb2 import (
6
6
  Artifact as ArtifactProto,