chalkcompute 2.1.0__tar.gz → 2.1.2__tar.gz
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.
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/PKG-INFO +2 -2
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_cls.py +83 -67
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_function.py +431 -75
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_remote_call_client.py +29 -32
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_tracing.py +3 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/pyproject.toml +2 -2
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/README.md +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/__init__.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_arrow_schema.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_auth_config.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_concurrency.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_connect.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_container.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/buf/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/buf/validate/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/buf/validate/validate_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/buf/validate/validate_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/arrow/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/arrow/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/arrow/v1/arrow_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/arrow/v1/arrow_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/arrow/v1/arrow_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/arrow/v1/arrow_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/agent_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/agent_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/agent_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/agent_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/audit_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/audit_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/audit_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/audit_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/displayagent_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/displayagent_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/displayagent_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/displayagent_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/featurepermission_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/featurepermission_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/featurepermission_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/featurepermission_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/permissions_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/permissions_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/permissions_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/auth/v1/permissions_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/common/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/common/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/common/v1/chalk_error_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/common/v1/chalk_error_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/container/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/container/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/container/v1/service_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/container/v1/service_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/container/v1/service_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/container/v1/service_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/externalfunctioncatalog/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/externalfunctioncatalog/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/externalfunctioncatalog/v1/service_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/externalfunctioncatalog/v1/service_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/externalfunctioncatalog/v1/service_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/externalfunctioncatalog/v1/service_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/runtime/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/runtime/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/runtime/v1/remote_python_call_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/runtime/v1/remote_python_call_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/sandbox/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/sandbox/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/sandbox/v1/service_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/sandbox/v1/service_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/sandbox/v1/service_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/sandbox/v1/service_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/scalinggroup/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/scalinggroup/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/scalinggroup/v1/service_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/scalinggroup/v1/service_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/scalinggroup/v1/service_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/scalinggroup/v1/service_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/encoding_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/encoding_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/encoding_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/encoding_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/field_change_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/field_change_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/field_change_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/field_change_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/sensitive_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/sensitive_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/sensitive_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/utils/v1/sensitive_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v1/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v1/volume_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v1/volume_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v1/volume_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v1/volume_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v2/__init__.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v2/volume_pb2.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v2/volume_pb2.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v2/volume_pb2_grpc.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_gen/chalk/volume/v2/volume_pb2_grpc.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_ignore.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_image.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_logging.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_model.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_naming.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_progress.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_proto_pool.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_quota.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_rate_limit.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_remote_call_native.pyi +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_remote_function_tracing.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_retry.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_sandbox.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_scaling_group.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_secret.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_volume.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/_vvolume.py +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/chalkcompute/py.typed +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/rust/chalkcompute_remote_client/Cargo.lock +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/rust/chalkcompute_remote_client/Cargo.toml +0 -0
- {chalkcompute-2.1.0 → chalkcompute-2.1.2}/rust/chalkcompute_remote_client/src/lib.rs +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chalkcompute
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Requires-Dist: grpcio>=1.60.0
|
|
5
5
|
Requires-Dist: protobuf>=4.25.0
|
|
6
6
|
Requires-Dist: httpx>=0.25.0
|
|
7
7
|
Requires-Dist: blake3>=1.0.0
|
|
8
|
-
Requires-Dist: chalk-remote-call-python>=1.
|
|
8
|
+
Requires-Dist: chalk-remote-call-python>=1.6.3
|
|
9
9
|
Requires-Dist: pyyaml>=6.0.0
|
|
10
10
|
Requires-Dist: opentelemetry-api>=1.20.0
|
|
11
11
|
Requires-Dist: opentelemetry-sdk>=1.20.0
|
|
@@ -47,6 +47,7 @@ import ast
|
|
|
47
47
|
import inspect
|
|
48
48
|
import logging
|
|
49
49
|
import os
|
|
50
|
+
import textwrap
|
|
50
51
|
import time
|
|
51
52
|
import typing
|
|
52
53
|
from dataclasses import dataclass, field
|
|
@@ -69,9 +70,11 @@ from chalkcompute._function import (
|
|
|
69
70
|
FunctionVersionInfo,
|
|
70
71
|
RemoteFunction,
|
|
71
72
|
SerializationFormat,
|
|
73
|
+
_assert_stripped_source_self_contained,
|
|
72
74
|
_build_and_upload,
|
|
73
75
|
_callable_input_names,
|
|
74
76
|
_cleanup_temp_files,
|
|
77
|
+
_entrypoint_source,
|
|
75
78
|
_extract_field_names,
|
|
76
79
|
_is_chalkcompute_decorator,
|
|
77
80
|
_local_install_entrypoint,
|
|
@@ -508,74 +511,78 @@ def _generate_class_handler_shim(
|
|
|
508
511
|
|
|
509
512
|
method_caller = "_instance" if method_has_self else class_name
|
|
510
513
|
if batched:
|
|
511
|
-
parts
|
|
512
|
-
""
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
514
|
+
parts.append(
|
|
515
|
+
textwrap.dedent(f"""\
|
|
516
|
+
_target = inspect.unwrap({method_caller}.{method_name})
|
|
517
|
+
_is_coroutine = inspect.iscoroutinefunction(_target)
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
def handler(events, contexts):
|
|
521
|
+
if _is_coroutine:
|
|
522
|
+
import asyncio
|
|
523
|
+
async def _run_all():
|
|
524
|
+
results = []
|
|
525
|
+
for event in events:
|
|
526
|
+
columns = {{k: v.to_pylist() for k, v in event.items()}}
|
|
527
|
+
n = len(next(iter(columns.values())))
|
|
528
|
+
per_caller = []
|
|
529
|
+
for i in range(n):
|
|
530
|
+
kwargs = {{k: v[i] for k, v in columns.items()}}
|
|
531
|
+
per_caller.append(await {method_caller}.{method_name}(**kwargs))
|
|
532
|
+
results.append(per_caller)
|
|
533
|
+
return results
|
|
534
|
+
return asyncio.run(_run_all())
|
|
535
|
+
results = []
|
|
536
|
+
for event in events:
|
|
537
|
+
columns = {{k: v.to_pylist() for k, v in event.items()}}
|
|
538
|
+
n = len(next(iter(columns.values())))
|
|
539
|
+
per_caller = []
|
|
540
|
+
for i in range(n):
|
|
541
|
+
kwargs = {{k: v[i] for k, v in columns.items()}}
|
|
542
|
+
per_caller.append({method_caller}.{method_name}(**kwargs))
|
|
543
|
+
results.append(per_caller)
|
|
544
|
+
return results
|
|
545
|
+
""").rstrip()
|
|
546
|
+
)
|
|
542
547
|
else:
|
|
543
|
-
parts
|
|
544
|
-
""
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
548
|
+
parts.append(
|
|
549
|
+
textwrap.dedent(f"""\
|
|
550
|
+
_target = inspect.unwrap({method_caller}.{method_name})
|
|
551
|
+
_is_sync_gen = inspect.isgeneratorfunction(_target)
|
|
552
|
+
_is_async_gen = inspect.isasyncgenfunction(_target)
|
|
553
|
+
_is_coroutine = inspect.iscoroutinefunction(_target) and not _is_async_gen
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
def handler(event, context):
|
|
557
|
+
n = len(next(iter(event.values())))
|
|
558
|
+
if _is_sync_gen:
|
|
559
|
+
def _gen():
|
|
560
|
+
for i in range(n):
|
|
561
|
+
kwargs = {{k: v[i].as_py() for k, v in event.items()}}
|
|
562
|
+
yield from {method_caller}.{method_name}(**kwargs)
|
|
563
|
+
return _gen()
|
|
564
|
+
elif _is_async_gen:
|
|
565
|
+
async def _agen():
|
|
566
|
+
for i in range(n):
|
|
567
|
+
kwargs = {{k: v[i].as_py() for k, v in event.items()}}
|
|
568
|
+
async for item in {method_caller}.{method_name}(**kwargs):
|
|
569
|
+
yield item
|
|
570
|
+
return _agen()
|
|
571
|
+
elif _is_coroutine:
|
|
572
|
+
import asyncio
|
|
573
|
+
results = []
|
|
574
|
+
for i in range(n):
|
|
575
|
+
kwargs = {{k: v[i].as_py() for k, v in event.items()}}
|
|
576
|
+
results.append(asyncio.run({method_caller}.{method_name}(**kwargs)))
|
|
577
|
+
return results
|
|
578
|
+
else:
|
|
579
|
+
results = []
|
|
580
|
+
for i in range(n):
|
|
581
|
+
kwargs = {{k: v[i].as_py() for k, v in event.items()}}
|
|
582
|
+
results.append({method_caller}.{method_name}(**kwargs))
|
|
583
|
+
return results
|
|
584
|
+
""").rstrip()
|
|
585
|
+
)
|
|
579
586
|
|
|
580
587
|
return "\n".join(parts) + "\n"
|
|
581
588
|
|
|
@@ -931,6 +938,15 @@ class RemoteClass:
|
|
|
931
938
|
if _should_strip_source():
|
|
932
939
|
source = _source_text_for_deploy(source_file)
|
|
933
940
|
stripped = _strip_chalkcompute_from_class_source(source)
|
|
941
|
+
entrypoint_sources: list[str] = []
|
|
942
|
+
for method_info in self._methods.values():
|
|
943
|
+
entrypoint_sources.extend(_entrypoint_source(method_info.func))
|
|
944
|
+
_assert_stripped_source_self_contained(
|
|
945
|
+
source,
|
|
946
|
+
stripped,
|
|
947
|
+
label=f"Class {self._class_name!r}",
|
|
948
|
+
entrypoint_sources=entrypoint_sources,
|
|
949
|
+
)
|
|
934
950
|
source_file = _write_temp(stripped)
|
|
935
951
|
temp_files.append(source_file)
|
|
936
952
|
elif not source_path.is_file():
|