chalkpy 2.96.7__py3-none-any.whl → 2.96.8__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.
chalk/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.96.7"
1
+ __version__ = "2.96.8"
chalk/client/client.py CHANGED
@@ -33,6 +33,7 @@ from chalk.client.models import (
33
33
  GetRegisteredModelResponse,
34
34
  GetRegisteredModelVersionResponse,
35
35
  ManualTriggerScheduledQueryResponse,
36
+ OfflineQueryDeadlineOptions,
36
37
  OfflineQueryInputUri,
37
38
  OnlineQuery,
38
39
  OnlineQueryContext,
@@ -927,7 +928,7 @@ class ChalkClient:
927
928
  store_offline: bool = False,
928
929
  num_shards: int | None = None,
929
930
  num_workers: int | None = None,
930
- completion_deadline: timedelta | None = None,
931
+ completion_deadline: Union[timedelta, OfflineQueryDeadlineOptions, None] = None,
931
932
  max_retries: int | None = None,
932
933
  query_name: str | None = None,
933
934
  query_name_version: str | None = None,
@@ -1043,8 +1044,8 @@ class ChalkClient:
1043
1044
  If specified, the query will be run asynchronously across a maximum `num_workers` pod workers at any time.
1044
1045
  This parameter is useful if you have a large number of shards and would like to limit the number of pods running at once.
1045
1046
  completion_deadline
1046
- If specified, shards must complete within 'completion_deadline' duration, or they will be terminated.
1047
- Terminated shards can be tried.
1047
+ If specified as a timedelta, applies a completion deadline to each shard; each shard's query will fail (allowing retries) if it does not complete within the duration.
1048
+ If specified as an OfflineQueryDeadlineOptions, allows more fine-grained control of shard- or query-level deadlines, with options to retry on failure or not.
1048
1049
  max_retries
1049
1050
  If specified, failed offline query shards will be retried. The retry budget is shared across all shards.
1050
1051
  By default, max_retries=num_shards/
@@ -12,6 +12,7 @@ from chalk.client.models import (
12
12
  BulkOnlineQueryResult,
13
13
  FeatureReference,
14
14
  FeatureStatisticsResponse,
15
+ OfflineQueryDeadlineOptions,
15
16
  OfflineQueryInputUri,
16
17
  OnlineQuery,
17
18
  OnlineQueryContext,
@@ -647,7 +648,7 @@ class AsyncChalkClient:
647
648
  store_offline: bool = False,
648
649
  num_shards: int | None = None,
649
650
  num_workers: int | None = None,
650
- completion_deadline: timedelta | None = None,
651
+ completion_deadline: Union[timedelta, OfflineQueryDeadlineOptions, None] = None,
651
652
  max_retries: int | None = None,
652
653
  query_name: str | None = None,
653
654
  query_name_version: str | None = None,
@@ -750,6 +751,9 @@ class AsyncChalkClient:
750
751
  num_workers
751
752
  If specified, the query will be run asynchronously across a maximum `num_workers` pod workers at any time.
752
753
  This parameter is useful if you have a large number of shards and would like to limit the number of pods running at once.
754
+ completion_deadline
755
+ If specified as a timedelta, applies a completion deadline to each shard; each shard's query will fail (allowing retries) if it does not complete within the duration.
756
+ If specified as an OfflineQueryDeadlineOptions, allows more fine-grained control of shard- or query-level deadlines, with options to retry on failure or not.
753
757
  query_name
754
758
  The name of the query to execute. If provided, will create a new named query or fill in missing parameters from a preexisting execution.
755
759
  query_name_version
@@ -103,6 +103,7 @@ from chalk.client.models import (
103
103
  MultiUploadFeaturesRequest,
104
104
  MultiUploadFeaturesResponse,
105
105
  OfflineQueryContext,
106
+ OfflineQueryDeadlineOptions,
106
107
  OfflineQueryInput,
107
108
  OfflineQueryInputSql,
108
109
  OfflineQueryInputUri,
@@ -2229,7 +2230,7 @@ https://docs.chalk.ai/cli/apply
2229
2230
  store_offline: bool = False,
2230
2231
  num_shards: int | None = None,
2231
2232
  num_workers: int | None = None,
2232
- completion_deadline: timedelta | None = None,
2233
+ completion_deadline: Union[timedelta, OfflineQueryDeadlineOptions, None] = None,
2233
2234
  max_retries: int | None = None,
2234
2235
  query_name: str | None = None,
2235
2236
  query_name_version: str | None = None,
@@ -3607,7 +3608,7 @@ https://docs.chalk.ai/cli/apply
3607
3608
  num_shards: int | None = None,
3608
3609
  num_workers: int | None = None,
3609
3610
  feature_for_lower_upper_bound: Optional[str] = None,
3610
- completion_deadline: timedelta | None = None,
3611
+ completion_deadline: Union[timedelta, OfflineQueryDeadlineOptions, None] = None,
3611
3612
  max_retries: int | None = None,
3612
3613
  optional_output_expressions: Optional[List[str]] = None,
3613
3614
  required_output_expressions: Optional[List[str]] = None,
@@ -3651,6 +3652,13 @@ https://docs.chalk.ai/cli/apply
3651
3652
  upper_bound_str = process_bound(upper_bound)
3652
3653
  if branch is ...:
3653
3654
  branch = self._branch
3655
+
3656
+ retyped_completion_deadline: Union[None, str, OfflineQueryDeadlineOptions] = None
3657
+ if isinstance(completion_deadline, OfflineQueryDeadlineOptions):
3658
+ retyped_completion_deadline = completion_deadline.with_chalk_durations()
3659
+ elif isinstance(completion_deadline, timedelta):
3660
+ retyped_completion_deadline = timedelta_to_duration(completion_deadline)
3661
+
3654
3662
  req = CreateOfflineQueryJobRequest(
3655
3663
  output=optional_output,
3656
3664
  output_expressions=optional_output_expressions or [],
@@ -3683,7 +3691,7 @@ https://docs.chalk.ai/cli/apply
3683
3691
  num_shards=num_shards,
3684
3692
  num_workers=num_workers,
3685
3693
  feature_for_lower_upper_bound=feature_for_lower_upper_bound,
3686
- completion_deadline=timedelta_to_duration(completion_deadline) if completion_deadline is not None else None,
3694
+ completion_deadline=retyped_completion_deadline,
3687
3695
  max_retries=max_retries,
3688
3696
  use_job_queue=use_job_queue,
3689
3697
  overlay_graph=_get_overlay_graph_b64(),
chalk/client/models.py CHANGED
@@ -20,6 +20,7 @@ from chalk.features.tag import EnvironmentId
20
20
  from chalk.prompts import Prompt
21
21
  from chalk.queries.query_context import ContextJsonDict
22
22
  from chalk.utils.df_utils import read_parquet
23
+ from chalk.utils.duration import timedelta_to_duration
23
24
  from chalk.utils.missing_dependency import missing_dependency_exception
24
25
 
25
26
  if TYPE_CHECKING:
@@ -820,6 +821,48 @@ class ResourceRequests(BaseModel):
820
821
  """Resource group to use for this job. If not specified, the default resource group will be used."""
821
822
 
822
823
 
824
+ class OfflineQueryDeadlineOptions(BaseModel):
825
+ """
826
+ Specification for setting deadlines for shards of the query or the entire query itself.
827
+ """
828
+
829
+ shard_deadline: Union[timedelta, str, None] = None
830
+ """
831
+ Maximum amount of time a query shard can work before being failed.
832
+ """
833
+
834
+ retry_on_shard_deadline: Optional[bool] = None
835
+ """
836
+ Whether to retry when the per-shard deadline is triggered. Will default to true.
837
+ """
838
+
839
+ query_deadline: Union[timedelta, str, None] = None
840
+ """
841
+ Maximum amount of time that the entire query can work before being failed.
842
+ """
843
+
844
+ retry_on_query_deadline: Optional[bool] = None
845
+ """
846
+ Whether to retry when the entire query's deadline is triggered. Will default to false.
847
+ """
848
+
849
+ def with_chalk_durations(self) -> OfflineQueryDeadlineOptions:
850
+ return OfflineQueryDeadlineOptions(
851
+ shard_deadline=(
852
+ timedelta_to_duration(self.shard_deadline)
853
+ if isinstance(self.shard_deadline, timedelta)
854
+ else self.shard_deadline
855
+ ),
856
+ retry_on_shard_deadline=self.retry_on_shard_deadline,
857
+ query_deadline=(
858
+ timedelta_to_duration(self.query_deadline)
859
+ if isinstance(self.query_deadline, timedelta)
860
+ else self.query_deadline
861
+ ),
862
+ retry_on_query_deadline=self.retry_on_query_deadline,
863
+ )
864
+
865
+
823
866
  class CreateOfflineQueryJobRequest(BaseModel):
824
867
  output: List[str]
825
868
  """A list of output feature root fqns to query"""
@@ -902,7 +945,7 @@ class CreateOfflineQueryJobRequest(BaseModel):
902
945
  num_workers: Optional[int] = None
903
946
  feature_for_lower_upper_bound: Optional[str] = None
904
947
 
905
- completion_deadline: Optional[str] = None
948
+ completion_deadline: Union[None, str, OfflineQueryDeadlineOptions] = None
906
949
  max_retries: Optional[int] = None
907
950
 
908
951
  use_job_queue: bool = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalkpy
3
- Version: 2.96.7
3
+ Version: 2.96.8
4
4
  Summary: Python SDK for Chalk
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -1,5 +1,5 @@
1
1
  chalk/__init__.py,sha256=vKsx9-cl5kImlVWGHVRYO6bweBm79NAzGs3l36u71wM,2657
2
- chalk/_version.py,sha256=3_AK7WV-Cb97v3VLeqbWqWc5ckXI1N8Wm6F3FsWkhQI,23
2
+ chalk/_version.py,sha256=XQBn2m_TF6iSSjpgoPtUzJ93WpjTyMNEkfPlAWxDliQ,23
3
3
  chalk/cli.py,sha256=ckqqfOI-A2mT23-rnZzDMmblYj-2x1VBX8ebHlIEn9A,5873
4
4
  chalk/importer.py,sha256=m4lMn1lSYj_euDq8CS7LYTBnek9JOcjGJf9-82dJHbA,64441
5
5
  chalk/prompts.py,sha256=2H9UomLAamdfRTNUdKs9i3VTpiossuyRhntqsAXUhhg,16117
@@ -612,14 +612,14 @@ chalk/_validation/validation.py,sha256=9cCMfZa9-1wxkXLme_ylmD5vIA1qExJD6aqbYvbmK
612
612
  chalk/byte_transmit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
613
613
  chalk/byte_transmit/model.py,sha256=LFX8pj9X_CWXeap7fDnMl9YmXsYTgq7jBAbEWkxoYoE,13048
614
614
  chalk/client/__init__.py,sha256=wu3WQVzE5gRj6noQQDOdYJUgDaz_9QtbjXH4KuoIlXQ,1782
615
- chalk/client/client.py,sha256=uu0S3bG0_6HG9S2seIH1oaww6Jz684fG9fIm3x2MwvI,103648
616
- chalk/client/client_async.py,sha256=I-1igsjYgK6qFh-KN524QBSvtxc8Yntltgt5fRHpQvA,51114
615
+ chalk/client/client.py,sha256=59UYbIq7KHwNm1ZFw5TmCV2JvbJxn45Ar_AjfSkuzQ8,103907
616
+ chalk/client/client_async.py,sha256=wD38RIkwVLaKYKj7K1bWDXnVZkLFYHsbY_5VhtflMvo,51559
617
617
  chalk/client/client_async_impl.py,sha256=ZphhgTB49JBWHCGXe-dI0wWWKc9zPcOczy02q_gFy50,6925
618
618
  chalk/client/client_grpc.py,sha256=skpSHYCyE8hg0T3Bcl5R8MMi92QjrFtxQRu_NxCSVlw,106952
619
- chalk/client/client_impl.py,sha256=rHkVYn0jawWwlFYPLseGuSm8sHwuLlMGY9uf1KSa8wY,211960
619
+ chalk/client/client_impl.py,sha256=3NDl1Vo7YJ0grraxJeN6vjFj1hBpU7YT_ikolK31D6k,212395
620
620
  chalk/client/dataset.py,sha256=LneWwaAOHCjtj7gaJjsSeVNruj-QJ51hjRi62zrFNVE,77561
621
621
  chalk/client/exc.py,sha256=kZJ80YbSeSRDmTLTh240j_eRdJFZBa7IaDsNSRoDroU,4145
622
- chalk/client/models.py,sha256=X3sq-kv4F601ABUcwE3Y7X-yF4sTHwbCk1HfX7xnhO0,64019
622
+ chalk/client/models.py,sha256=YwXywN6OSPOda1DKJuPVe6hgsHzf8ewvX2dYOBOZk7I,65534
623
623
  chalk/client/response.py,sha256=m8sQCOj7YVv3mZSZMIC1rIMzFMQ9rfMdBRLg5NRmOOE,53257
624
624
  chalk/client/_internal_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
625
625
  chalk/client/_internal_models/check.py,sha256=3Xfo4Ws4rvwjeVg0-5-kejfRfRBJeqHmnRhW-WEz784,917
@@ -827,8 +827,8 @@ chalk/utils/tracing.py,sha256=NiiM-9dbuJhSCv6R1npR1uYNKWlkqTR6Ygm0Voi2NrY,13078
827
827
  chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
828
828
  chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
829
829
  chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
830
- chalkpy-2.96.7.dist-info/METADATA,sha256=QWqtSzsETPKu6gG6oHi0s_nhv7SfLSuca2-SjNFKAKU,27754
831
- chalkpy-2.96.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
832
- chalkpy-2.96.7.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
833
- chalkpy-2.96.7.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
834
- chalkpy-2.96.7.dist-info/RECORD,,
830
+ chalkpy-2.96.8.dist-info/METADATA,sha256=wLMi2G7i8tczLoHoAAYiMWG9g2oujf4DoUmq3hqkP98,27754
831
+ chalkpy-2.96.8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
832
+ chalkpy-2.96.8.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
833
+ chalkpy-2.96.8.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
834
+ chalkpy-2.96.8.dist-info/RECORD,,