chalkpy 2.93.1__py3-none-any.whl → 2.93.2__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 +1 -1
- chalk/client/client.py +5 -0
- chalk/client/client_async.py +5 -0
- chalk/client/client_impl.py +73 -44
- chalk/client/models.py +10 -0
- {chalkpy-2.93.1.dist-info → chalkpy-2.93.2.dist-info}/METADATA +1 -1
- {chalkpy-2.93.1.dist-info → chalkpy-2.93.2.dist-info}/RECORD +10 -10
- {chalkpy-2.93.1.dist-info → chalkpy-2.93.2.dist-info}/WHEEL +0 -0
- {chalkpy-2.93.1.dist-info → chalkpy-2.93.2.dist-info}/entry_points.txt +0 -0
- {chalkpy-2.93.1.dist-info → chalkpy-2.93.2.dist-info}/top_level.txt +0 -0
chalk/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.93.
|
|
1
|
+
__version__ = "2.93.2"
|
chalk/client/client.py
CHANGED
|
@@ -924,6 +924,8 @@ class ChalkClient:
|
|
|
924
924
|
max_retries: int | None = None,
|
|
925
925
|
query_name: str | None = None,
|
|
926
926
|
query_name_version: str | None = None,
|
|
927
|
+
*,
|
|
928
|
+
input_sql: str | None = None,
|
|
927
929
|
) -> Dataset:
|
|
928
930
|
"""Compute feature values from the offline store or by running offline/online resolvers.
|
|
929
931
|
See `Dataset` for more information.
|
|
@@ -944,6 +946,9 @@ class ChalkClient:
|
|
|
944
946
|
times, the list must match the length of the `input` lists. Each element of input_time corresponds with the
|
|
945
947
|
feature values at the same index of the `input` lists.
|
|
946
948
|
See https://docs.chalk.ai/docs/temporal-consistency for more information.
|
|
949
|
+
input_sql
|
|
950
|
+
An alternative to `input`: a ChalkSQL query that returns values
|
|
951
|
+
to use as inputs.
|
|
947
952
|
output
|
|
948
953
|
The features that you'd like to sample, if they exist.
|
|
949
954
|
If an output feature was never computed for a sample (row) in
|
chalk/client/client_async.py
CHANGED
|
@@ -646,6 +646,8 @@ class AsyncChalkClient:
|
|
|
646
646
|
max_retries: int | None = None,
|
|
647
647
|
query_name: str | None = None,
|
|
648
648
|
query_name_version: str | None = None,
|
|
649
|
+
*,
|
|
650
|
+
input_sql: str | None = None,
|
|
649
651
|
) -> Dataset:
|
|
650
652
|
"""Compute feature values from the offline store or by running offline/online resolvers.
|
|
651
653
|
See `Dataset` for more information.
|
|
@@ -660,6 +662,9 @@ class AsyncChalkClient:
|
|
|
660
662
|
an observation in line with the timestamp in `input_times`.
|
|
661
663
|
input_times
|
|
662
664
|
A list of the times of the observations from `input`.
|
|
665
|
+
input_sql
|
|
666
|
+
An alternative to `input`: a ChalkSQL query that returns values
|
|
667
|
+
to use as inputs.
|
|
663
668
|
output
|
|
664
669
|
The features that you'd like to sample, if they exist.
|
|
665
670
|
If an output feature was never computed for a sample (row) in
|
chalk/client/client_impl.py
CHANGED
|
@@ -103,6 +103,7 @@ from chalk.client.models import (
|
|
|
103
103
|
MultiUploadFeaturesResponse,
|
|
104
104
|
OfflineQueryContext,
|
|
105
105
|
OfflineQueryInput,
|
|
106
|
+
OfflineQueryInputSql,
|
|
106
107
|
OfflineQueryInputUri,
|
|
107
108
|
OfflineQueryParquetUploadURLResponse,
|
|
108
109
|
OnlineQuery,
|
|
@@ -2238,6 +2239,8 @@ https://docs.chalk.ai/cli/apply
|
|
|
2238
2239
|
override_target_image_tag: Optional[str] = None,
|
|
2239
2240
|
feature_for_lower_upper_bound: Optional[FeatureReference] = None,
|
|
2240
2241
|
use_job_queue: bool = False,
|
|
2242
|
+
*,
|
|
2243
|
+
input_sql: str | None = None,
|
|
2241
2244
|
) -> DatasetImpl:
|
|
2242
2245
|
run_asynchronously = (
|
|
2243
2246
|
use_multiple_computers
|
|
@@ -2260,11 +2263,6 @@ https://docs.chalk.ai/cli/apply
|
|
|
2260
2263
|
if query_name is None and query_name_version is not None:
|
|
2261
2264
|
raise ValueError("Passed 'query_name_version' without 'query_name'.")
|
|
2262
2265
|
|
|
2263
|
-
if max_samples is not None and input is not None:
|
|
2264
|
-
raise ValueError(
|
|
2265
|
-
"Cannot specify both 'max_samples' and 'input'. 'max_samples' is only valid when input is None."
|
|
2266
|
-
)
|
|
2267
|
-
|
|
2268
2266
|
if isinstance(num_shards, int) and num_shards < 1:
|
|
2269
2267
|
raise ValueError("num_shards must be greater than 0")
|
|
2270
2268
|
if isinstance(num_workers, int) and num_workers < 1:
|
|
@@ -2285,48 +2283,70 @@ https://docs.chalk.ai/cli/apply
|
|
|
2285
2283
|
|
|
2286
2284
|
context = OfflineQueryContext(environment=environment)
|
|
2287
2285
|
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
# by this point, should be
|
|
2300
|
-
# Union[QueryInput, List[QueryInput], Tuple[QueryInput, ...]]
|
|
2301
|
-
if isinstance(input, (list, tuple)):
|
|
2302
|
-
input_times_tuple: Sequence[QueryInputTime] = (
|
|
2303
|
-
[None] * len(input)
|
|
2304
|
-
if input_times is None
|
|
2305
|
-
else [input_times for _ in input]
|
|
2306
|
-
if isinstance(input_times, datetime)
|
|
2307
|
-
else input_times
|
|
2286
|
+
_check_exclusive_options(
|
|
2287
|
+
{
|
|
2288
|
+
"input": input,
|
|
2289
|
+
"input_sql": input_sql,
|
|
2290
|
+
"max_samples": max_samples,
|
|
2291
|
+
}
|
|
2292
|
+
)
|
|
2293
|
+
if input_sql is not None:
|
|
2294
|
+
if input_times is not None:
|
|
2295
|
+
raise ValueError(
|
|
2296
|
+
f"Cannot specify `input_sql` and `input_times` together. Instead, the ChalkSQL query may output a `{TS_COL_NAME}` column"
|
|
2308
2297
|
)
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
multi_input = [(input, cast(None, input_times))]
|
|
2298
|
+
if num_shards is not None:
|
|
2299
|
+
raise ValueError("Cannot specify `input_sql` and `num_shards` together.")
|
|
2300
|
+
if num_workers is not None:
|
|
2301
|
+
raise ValueError("Cannot specify `input_sql` and `num_workers` together.")
|
|
2314
2302
|
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
query_input = tuple(_to_offline_query_input(x, t) for x, t in multi_input)
|
|
2303
|
+
# Set query_input
|
|
2304
|
+
if input is not None:
|
|
2305
|
+
# Set query_input from input
|
|
2306
|
+
if isinstance(input, OfflineQueryInputUri):
|
|
2307
|
+
query_input = input
|
|
2308
|
+
elif isinstance(input, str):
|
|
2309
|
+
query_input = OfflineQueryInputUri(
|
|
2310
|
+
parquet_uri=input,
|
|
2311
|
+
start_row=None,
|
|
2312
|
+
end_row=None,
|
|
2313
|
+
)
|
|
2327
2314
|
else:
|
|
2328
|
-
|
|
2329
|
-
|
|
2315
|
+
# by this point, should be
|
|
2316
|
+
# Union[QueryInput, List[QueryInput], Tuple[QueryInput, ...]]
|
|
2317
|
+
if isinstance(input, (list, tuple)):
|
|
2318
|
+
input_times_tuple: Sequence[QueryInputTime] = (
|
|
2319
|
+
[None] * len(input)
|
|
2320
|
+
if input_times is None
|
|
2321
|
+
else [input_times for _ in input]
|
|
2322
|
+
if isinstance(input_times, datetime)
|
|
2323
|
+
else input_times
|
|
2324
|
+
)
|
|
2325
|
+
run_asynchronously = True
|
|
2326
|
+
multi_input = list(zip(input, input_times_tuple))
|
|
2327
|
+
else:
|
|
2328
|
+
# Just a QueryInput
|
|
2329
|
+
multi_input = [(input, cast(None, input_times))]
|
|
2330
|
+
|
|
2331
|
+
# defaulting to uploading input as table if inputs are large
|
|
2332
|
+
if upload_input_as_table or _offline_query_inputs_should_be_uploaded(input) or num_shards:
|
|
2333
|
+
with ThreadPoolExecutor(thread_name_prefix="offline_query_upload_input") as upload_input_executor:
|
|
2334
|
+
query_input = self._upload_offline_query_input(
|
|
2335
|
+
multi_input,
|
|
2336
|
+
context=context,
|
|
2337
|
+
branch=branch,
|
|
2338
|
+
executor=upload_input_executor,
|
|
2339
|
+
num_shards=num_shards,
|
|
2340
|
+
)
|
|
2341
|
+
elif run_asynchronously:
|
|
2342
|
+
query_input = tuple(_to_offline_query_input(x, t) for x, t in multi_input)
|
|
2343
|
+
else:
|
|
2344
|
+
assert len(multi_input) == 1, "We should default to running asynchronously if inputs is partitioned"
|
|
2345
|
+
query_input = _to_offline_query_input(*multi_input[0])
|
|
2346
|
+
elif input_sql is not None:
|
|
2347
|
+
query_input = OfflineQueryInputSql(input_sql=input_sql)
|
|
2348
|
+
else:
|
|
2349
|
+
query_input = None
|
|
2330
2350
|
|
|
2331
2351
|
response = self._create_dataset_job(
|
|
2332
2352
|
optional_output=optional_output_root_fqns,
|
|
@@ -3450,6 +3470,7 @@ https://docs.chalk.ai/cli/apply
|
|
|
3450
3470
|
Optional[OfflineQueryInput],
|
|
3451
3471
|
UploadedParquetShardedOfflineQueryInput,
|
|
3452
3472
|
OfflineQueryInputUri,
|
|
3473
|
+
OfflineQueryInputSql,
|
|
3453
3474
|
],
|
|
3454
3475
|
max_samples: Optional[int],
|
|
3455
3476
|
dataset_name: Optional[str],
|
|
@@ -5212,3 +5233,11 @@ https://docs.chalk.ai/cli/apply
|
|
|
5212
5233
|
client_grpc.follow_model_training_job(operation_id=task_response.task_id)
|
|
5213
5234
|
|
|
5214
5235
|
return CreateModelTrainingJobResponse(success=True)
|
|
5236
|
+
|
|
5237
|
+
|
|
5238
|
+
def _check_exclusive_options(options: dict[str, Any | None]):
|
|
5239
|
+
filled_options = {k: v for k, v in options.items() if v is not None}
|
|
5240
|
+
if len(filled_options) > 1:
|
|
5241
|
+
raise ValueError(
|
|
5242
|
+
f"Only one of the options: {', '.join(filled_options.keys())} can be specified (they are mutually exclusive options)."
|
|
5243
|
+
)
|
chalk/client/models.py
CHANGED
|
@@ -460,6 +460,15 @@ class OfflineQueryInput(BaseModel):
|
|
|
460
460
|
values: List[List[Any]] # Values should be of type TJSON
|
|
461
461
|
|
|
462
462
|
|
|
463
|
+
class OfflineQueryInputSql(BaseModel):
|
|
464
|
+
"""Input to an offline query specified as a ChalkSQL query instead
|
|
465
|
+
of literal data.
|
|
466
|
+
|
|
467
|
+
Alternative to OfflineQueryInput or OfflineQueryInputUri."""
|
|
468
|
+
|
|
469
|
+
input_sql: str
|
|
470
|
+
|
|
471
|
+
|
|
463
472
|
class OnlineQueryRequest(BaseModel):
|
|
464
473
|
inputs: Mapping[str, Any] # Values should be of type TJSON
|
|
465
474
|
outputs: List[str]
|
|
@@ -838,6 +847,7 @@ class CreateOfflineQueryJobRequest(BaseModel):
|
|
|
838
847
|
None,
|
|
839
848
|
UploadedParquetShardedOfflineQueryInput,
|
|
840
849
|
OfflineQueryInputUri,
|
|
850
|
+
OfflineQueryInputSql,
|
|
841
851
|
] = None
|
|
842
852
|
"""Any givens"""
|
|
843
853
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
chalk/__init__.py,sha256=9YxwkAt3Im0OCMfpmnIB_4PKjZfBCcRmwATLXdHNRm4,2609
|
|
2
|
-
chalk/_version.py,sha256=
|
|
2
|
+
chalk/_version.py,sha256=t2ehNNV4nh6yMJVBg9EP9Y9nTxjmn2UHhlYfxUMfc_Q,23
|
|
3
3
|
chalk/cli.py,sha256=ckqqfOI-A2mT23-rnZzDMmblYj-2x1VBX8ebHlIEn9A,5873
|
|
4
4
|
chalk/importer.py,sha256=hCEo7eqSfXZWklkFB2geeipGhiD0qNjPBpQJvOBW6N0,63083
|
|
5
5
|
chalk/prompts.py,sha256=2H9UomLAamdfRTNUdKs9i3VTpiossuyRhntqsAXUhhg,16117
|
|
@@ -550,14 +550,14 @@ chalk/_validation/validation.py,sha256=9cCMfZa9-1wxkXLme_ylmD5vIA1qExJD6aqbYvbmK
|
|
|
550
550
|
chalk/byte_transmit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
551
551
|
chalk/byte_transmit/model.py,sha256=LFX8pj9X_CWXeap7fDnMl9YmXsYTgq7jBAbEWkxoYoE,13048
|
|
552
552
|
chalk/client/__init__.py,sha256=wu3WQVzE5gRj6noQQDOdYJUgDaz_9QtbjXH4KuoIlXQ,1782
|
|
553
|
-
chalk/client/client.py,sha256=
|
|
554
|
-
chalk/client/client_async.py,sha256=
|
|
553
|
+
chalk/client/client.py,sha256=xq3_AgshEA0KR2tZ-tJ4lxU_UGmEL_1WG_o6mRQgmZE,101056
|
|
554
|
+
chalk/client/client_async.py,sha256=nFFTWJbdBlb7zksyjOMBY566tZTAyNXQhCnq06LHWl0,50803
|
|
555
555
|
chalk/client/client_async_impl.py,sha256=ZphhgTB49JBWHCGXe-dI0wWWKc9zPcOczy02q_gFy50,6925
|
|
556
556
|
chalk/client/client_grpc.py,sha256=nwURtE99LFHWXsHiJwOA_xTocYl9XUmThkjtm1Eujkg,90672
|
|
557
|
-
chalk/client/client_impl.py,sha256=
|
|
557
|
+
chalk/client/client_impl.py,sha256=Od07ybvm3or4GL5WpqR86ZSiVNcwvUPRLwRc7dnWlIc,208031
|
|
558
558
|
chalk/client/dataset.py,sha256=LneWwaAOHCjtj7gaJjsSeVNruj-QJ51hjRi62zrFNVE,77561
|
|
559
559
|
chalk/client/exc.py,sha256=kZJ80YbSeSRDmTLTh240j_eRdJFZBa7IaDsNSRoDroU,4145
|
|
560
|
-
chalk/client/models.py,sha256=
|
|
560
|
+
chalk/client/models.py,sha256=CqJ8vdMAPrjOo--GWQVr2WF3zfP5bfhULho0_YL0p6o,60883
|
|
561
561
|
chalk/client/response.py,sha256=m8sQCOj7YVv3mZSZMIC1rIMzFMQ9rfMdBRLg5NRmOOE,53257
|
|
562
562
|
chalk/client/_internal_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
563
563
|
chalk/client/_internal_models/check.py,sha256=3Xfo4Ws4rvwjeVg0-5-kejfRfRBJeqHmnRhW-WEz784,917
|
|
@@ -764,8 +764,8 @@ chalk/utils/tracing.py,sha256=Glx8YrtjWy0zE5YbpgfgcsLDshAKnnYm9poiWNeCxXs,11075
|
|
|
764
764
|
chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
|
|
765
765
|
chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
766
766
|
chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
|
|
767
|
-
chalkpy-2.93.
|
|
768
|
-
chalkpy-2.93.
|
|
769
|
-
chalkpy-2.93.
|
|
770
|
-
chalkpy-2.93.
|
|
771
|
-
chalkpy-2.93.
|
|
767
|
+
chalkpy-2.93.2.dist-info/METADATA,sha256=MJ-YYfA49s9AzRQLShAVA47L5kLMpWOXE0V4VtowCEM,27494
|
|
768
|
+
chalkpy-2.93.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
769
|
+
chalkpy-2.93.2.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
|
|
770
|
+
chalkpy-2.93.2.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
|
|
771
|
+
chalkpy-2.93.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|