dagster-cloud 1.8.2__py3-none-any.whl → 1.12.6__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.
- dagster_cloud/__init__.py +3 -3
- dagster_cloud/agent/__init__.py +4 -4
- dagster_cloud/agent/cli/__init__.py +56 -17
- dagster_cloud/agent/dagster_cloud_agent.py +360 -172
- dagster_cloud/agent/instrumentation/__init__.py +0 -0
- dagster_cloud/agent/instrumentation/constants.py +2 -0
- dagster_cloud/agent/instrumentation/run_launch.py +23 -0
- dagster_cloud/agent/instrumentation/schedule.py +34 -0
- dagster_cloud/agent/instrumentation/sensor.py +34 -0
- dagster_cloud/anomaly_detection/__init__.py +2 -2
- dagster_cloud/anomaly_detection/defs.py +17 -12
- dagster_cloud/anomaly_detection/types.py +3 -3
- dagster_cloud/api/dagster_cloud_api.py +209 -293
- dagster_cloud/auth/constants.py +21 -5
- dagster_cloud/batching/__init__.py +1 -0
- dagster_cloud/batching/batcher.py +210 -0
- dagster_cloud/dagster_insights/__init__.py +12 -6
- dagster_cloud/dagster_insights/bigquery/bigquery_utils.py +3 -2
- dagster_cloud/dagster_insights/bigquery/dbt_wrapper.py +39 -12
- dagster_cloud/dagster_insights/bigquery/insights_bigquery_resource.py +8 -6
- dagster_cloud/dagster_insights/insights_utils.py +18 -8
- dagster_cloud/dagster_insights/metrics_utils.py +12 -12
- dagster_cloud/dagster_insights/snowflake/dagster_snowflake_insights.py +5 -12
- dagster_cloud/dagster_insights/snowflake/dbt_wrapper.py +34 -8
- dagster_cloud/dagster_insights/snowflake/definitions.py +38 -12
- dagster_cloud/dagster_insights/snowflake/insights_snowflake_resource.py +11 -23
- dagster_cloud/definitions/__init__.py +0 -0
- dagster_cloud/definitions/job_selection.py +36 -0
- dagster_cloud/execution/cloud_run_launcher/k8s.py +1 -1
- dagster_cloud/execution/cloud_run_launcher/process.py +3 -3
- dagster_cloud/execution/monitoring/__init__.py +27 -33
- dagster_cloud/execution/utils/process.py +3 -3
- dagster_cloud/instance/__init__.py +125 -38
- dagster_cloud/instrumentation/__init__.py +32 -0
- dagster_cloud/metadata/source_code.py +13 -8
- dagster_cloud/metrics/__init__.py +0 -0
- dagster_cloud/metrics/tracer.py +59 -0
- dagster_cloud/opentelemetry/__init__.py +0 -0
- dagster_cloud/opentelemetry/config/__init__.py +73 -0
- dagster_cloud/opentelemetry/config/exporter.py +81 -0
- dagster_cloud/opentelemetry/config/log_record_processor.py +40 -0
- dagster_cloud/opentelemetry/config/logging_handler.py +14 -0
- dagster_cloud/opentelemetry/config/meter_provider.py +9 -0
- dagster_cloud/opentelemetry/config/metric_reader.py +39 -0
- dagster_cloud/opentelemetry/controller.py +319 -0
- dagster_cloud/opentelemetry/enum.py +58 -0
- dagster_cloud/opentelemetry/factories/__init__.py +1 -0
- dagster_cloud/opentelemetry/factories/logs.py +113 -0
- dagster_cloud/opentelemetry/factories/metrics.py +121 -0
- dagster_cloud/opentelemetry/metrics/__init__.py +0 -0
- dagster_cloud/opentelemetry/metrics/meter.py +140 -0
- dagster_cloud/opentelemetry/observers/__init__.py +0 -0
- dagster_cloud/opentelemetry/observers/dagster_exception_handler.py +40 -0
- dagster_cloud/opentelemetry/observers/execution_observer.py +178 -0
- dagster_cloud/pex/grpc/__generated__/multi_pex_api_pb2.pyi +175 -0
- dagster_cloud/pex/grpc/__init__.py +2 -2
- dagster_cloud/pex/grpc/client.py +4 -4
- dagster_cloud/pex/grpc/compile.py +2 -2
- dagster_cloud/pex/grpc/server/__init__.py +2 -2
- dagster_cloud/pex/grpc/server/cli/__init__.py +31 -19
- dagster_cloud/pex/grpc/server/manager.py +60 -42
- dagster_cloud/pex/grpc/server/registry.py +28 -21
- dagster_cloud/pex/grpc/server/server.py +23 -14
- dagster_cloud/pex/grpc/types.py +5 -5
- dagster_cloud/py.typed +0 -0
- dagster_cloud/secrets/__init__.py +1 -1
- dagster_cloud/secrets/loader.py +3 -3
- dagster_cloud/serverless/__init__.py +1 -1
- dagster_cloud/serverless/io_manager.py +36 -53
- dagster_cloud/storage/client.py +54 -17
- dagster_cloud/storage/compute_logs/__init__.py +3 -1
- dagster_cloud/storage/compute_logs/compute_log_manager.py +22 -17
- dagster_cloud/storage/defs_state/__init__.py +3 -0
- dagster_cloud/storage/defs_state/queries.py +15 -0
- dagster_cloud/storage/defs_state/storage.py +113 -0
- dagster_cloud/storage/event_logs/__init__.py +3 -1
- dagster_cloud/storage/event_logs/queries.py +102 -4
- dagster_cloud/storage/event_logs/storage.py +266 -73
- dagster_cloud/storage/event_logs/utils.py +88 -7
- dagster_cloud/storage/runs/__init__.py +1 -1
- dagster_cloud/storage/runs/queries.py +17 -2
- dagster_cloud/storage/runs/storage.py +88 -42
- dagster_cloud/storage/schedules/__init__.py +1 -1
- dagster_cloud/storage/schedules/storage.py +6 -8
- dagster_cloud/storage/tags.py +66 -1
- dagster_cloud/util/__init__.py +10 -12
- dagster_cloud/util/errors.py +49 -64
- dagster_cloud/version.py +1 -1
- dagster_cloud/workspace/config_schema/__init__.py +55 -13
- dagster_cloud/workspace/docker/__init__.py +76 -25
- dagster_cloud/workspace/docker/utils.py +1 -1
- dagster_cloud/workspace/ecs/__init__.py +1 -1
- dagster_cloud/workspace/ecs/client.py +51 -33
- dagster_cloud/workspace/ecs/launcher.py +76 -22
- dagster_cloud/workspace/ecs/run_launcher.py +3 -3
- dagster_cloud/workspace/ecs/utils.py +14 -5
- dagster_cloud/workspace/kubernetes/__init__.py +1 -1
- dagster_cloud/workspace/kubernetes/launcher.py +61 -29
- dagster_cloud/workspace/kubernetes/utils.py +34 -22
- dagster_cloud/workspace/user_code_launcher/__init__.py +5 -3
- dagster_cloud/workspace/user_code_launcher/process.py +16 -14
- dagster_cloud/workspace/user_code_launcher/user_code_launcher.py +552 -172
- dagster_cloud/workspace/user_code_launcher/utils.py +105 -1
- {dagster_cloud-1.8.2.dist-info → dagster_cloud-1.12.6.dist-info}/METADATA +48 -42
- dagster_cloud-1.12.6.dist-info/RECORD +134 -0
- {dagster_cloud-1.8.2.dist-info → dagster_cloud-1.12.6.dist-info}/WHEEL +1 -1
- dagster_cloud-1.8.2.dist-info/RECORD +0 -100
- {dagster_cloud-1.8.2.dist-info → dagster_cloud-1.12.6.dist-info}/top_level.txt +0 -0
dagster_cloud/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from dagster._core.libraries import DagsterLibraryRegistry
|
|
2
2
|
|
|
3
|
-
from .instance import DagsterCloudAgentInstance as DagsterCloudAgentInstance
|
|
4
|
-
from .storage.compute_logs import CloudComputeLogManager as CloudComputeLogManager
|
|
5
|
-
from .version import __version__
|
|
3
|
+
from dagster_cloud.instance import DagsterCloudAgentInstance as DagsterCloudAgentInstance
|
|
4
|
+
from dagster_cloud.storage.compute_logs import CloudComputeLogManager as CloudComputeLogManager
|
|
5
|
+
from dagster_cloud.version import __version__
|
|
6
6
|
|
|
7
7
|
DagsterLibraryRegistry.register("dagster-cloud", __version__)
|
dagster_cloud/agent/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import NamedTuple, Optional
|
|
2
2
|
|
|
3
3
|
from dagster._serdes import whitelist_for_serdes
|
|
4
4
|
from dagster_cloud_cli.core.agent_queue import AgentQueue
|
|
@@ -7,14 +7,14 @@ from dagster_cloud_cli.core.agent_queue import AgentQueue
|
|
|
7
7
|
@whitelist_for_serdes
|
|
8
8
|
class AgentQueuesConfig(NamedTuple):
|
|
9
9
|
include_default_queue: bool = True
|
|
10
|
-
additional_queues: Optional[
|
|
10
|
+
additional_queues: Optional[list[AgentQueue]] = None
|
|
11
11
|
|
|
12
12
|
@staticmethod
|
|
13
|
-
def default_queues() ->
|
|
13
|
+
def default_queues() -> list[AgentQueue]:
|
|
14
14
|
return [None]
|
|
15
15
|
|
|
16
16
|
@property
|
|
17
|
-
def queues(self) ->
|
|
17
|
+
def queues(self) -> list[AgentQueue]:
|
|
18
18
|
if self.additional_queues:
|
|
19
19
|
queues = self.additional_queues.copy()
|
|
20
20
|
else:
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
+
import logging.config
|
|
3
4
|
import os
|
|
5
|
+
from collections.abc import Mapping
|
|
4
6
|
from pathlib import Path
|
|
5
7
|
from tempfile import TemporaryDirectory
|
|
6
|
-
from typing import Optional
|
|
8
|
+
from typing import Optional, cast
|
|
7
9
|
|
|
10
|
+
import dagster._check as check
|
|
8
11
|
import yaml
|
|
9
12
|
from dagster._core.errors import DagsterHomeNotSetError
|
|
10
13
|
from dagster._utils.interrupts import capture_interrupts
|
|
11
14
|
from dagster._utils.log import default_date_format_string, default_format_string
|
|
12
15
|
from dagster._utils.merger import deep_merge_dicts
|
|
13
|
-
from dagster._utils.yaml_utils import load_yaml_from_globs
|
|
14
16
|
from dagster_cloud_cli import ui
|
|
17
|
+
from dagster_shared.yaml_utils import load_yaml_from_globs
|
|
15
18
|
from typer import Argument, Option, Typer
|
|
16
19
|
|
|
17
20
|
from dagster_cloud.agent.dagster_cloud_agent import DagsterCloudAgent
|
|
@@ -35,9 +38,11 @@ def agent_home_exception():
|
|
|
35
38
|
return ui.error(f"No Dagster config found.\n\n{dagster_home_loc}")
|
|
36
39
|
|
|
37
40
|
|
|
38
|
-
def run_local_agent(
|
|
41
|
+
def run_local_agent(agent_logging_config: Optional[Mapping[str, object]]) -> None:
|
|
39
42
|
try:
|
|
40
|
-
with DagsterCloudAgentInstance.get() as
|
|
43
|
+
with DagsterCloudAgentInstance.get() as inst:
|
|
44
|
+
instance = check.inst(inst, DagsterCloudAgentInstance)
|
|
45
|
+
|
|
41
46
|
logging.basicConfig(
|
|
42
47
|
level=logging.INFO,
|
|
43
48
|
format=default_format_string(),
|
|
@@ -45,25 +50,26 @@ def run_local_agent(agent_logging_config_path):
|
|
|
45
50
|
handlers=[logging.StreamHandler()],
|
|
46
51
|
)
|
|
47
52
|
|
|
48
|
-
if
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if agent_logging_config:
|
|
54
|
+
logging.config.dictConfig(
|
|
55
|
+
{
|
|
56
|
+
"version": 1,
|
|
57
|
+
"disable_existing_loggers": False,
|
|
58
|
+
**agent_logging_config,
|
|
59
|
+
}
|
|
60
|
+
)
|
|
55
61
|
|
|
56
62
|
user_code_launcher = instance.user_code_launcher
|
|
57
63
|
user_code_launcher.start()
|
|
58
64
|
|
|
59
|
-
with DagsterCloudAgent() as agent:
|
|
60
|
-
agent.run_loop(
|
|
65
|
+
with DagsterCloudAgent(instance) as agent:
|
|
66
|
+
agent.run_loop(user_code_launcher, agent_uuid=instance.instance_uuid)
|
|
61
67
|
except DagsterHomeNotSetError:
|
|
62
68
|
raise agent_home_exception()
|
|
63
69
|
|
|
64
70
|
|
|
65
71
|
def run_local_agent_in_environment(
|
|
66
|
-
dagster_home: Optional[Path],
|
|
72
|
+
dagster_home: Optional[Path], agent_logging_config: Optional[Mapping[str, object]]
|
|
67
73
|
):
|
|
68
74
|
with capture_interrupts():
|
|
69
75
|
old_env = None
|
|
@@ -71,7 +77,7 @@ def run_local_agent_in_environment(
|
|
|
71
77
|
old_env = dict(os.environ)
|
|
72
78
|
if dagster_home:
|
|
73
79
|
os.environ["DAGSTER_HOME"] = str(dagster_home.resolve())
|
|
74
|
-
run_local_agent(
|
|
80
|
+
run_local_agent(agent_logging_config)
|
|
75
81
|
finally:
|
|
76
82
|
os.environ.clear()
|
|
77
83
|
if old_env is not None:
|
|
@@ -86,6 +92,7 @@ def run_local_agent_in_temp_environment(
|
|
|
86
92
|
user_code_launcher_module: Optional[str],
|
|
87
93
|
user_code_launcher_class: Optional[str],
|
|
88
94
|
user_code_launcher_config: Optional[str],
|
|
95
|
+
agent_logging_config: Optional[Mapping[str, object]],
|
|
89
96
|
):
|
|
90
97
|
config = {
|
|
91
98
|
"instance_class": {
|
|
@@ -121,7 +128,7 @@ def run_local_agent_in_temp_environment(
|
|
|
121
128
|
with TemporaryDirectory() as d:
|
|
122
129
|
with open(os.path.join(d, "dagster.yaml"), "w", encoding="utf8") as f:
|
|
123
130
|
f.write(yaml.dump(config))
|
|
124
|
-
run_local_agent_in_environment(Path(d),
|
|
131
|
+
run_local_agent_in_environment(Path(d), agent_logging_config)
|
|
125
132
|
|
|
126
133
|
|
|
127
134
|
@app.command(
|
|
@@ -170,7 +177,23 @@ def run(
|
|
|
170
177
|
),
|
|
171
178
|
exists=True,
|
|
172
179
|
),
|
|
180
|
+
agent_logging_config_string: Optional[str] = Option(
|
|
181
|
+
None,
|
|
182
|
+
"--agent-logging-config-string",
|
|
183
|
+
help=(
|
|
184
|
+
"inlined json with logging config for the agent process that can be passed into"
|
|
185
|
+
" logging.dictConfig. Cannot be provided if --agent-logging-config-path is specified."
|
|
186
|
+
),
|
|
187
|
+
),
|
|
173
188
|
):
|
|
189
|
+
if agent_logging_config_string and agent_logging_config_path:
|
|
190
|
+
raise ui.error(
|
|
191
|
+
"Only --agent-logging-config-path or --agent-logging-config-string can be specified, not both"
|
|
192
|
+
)
|
|
193
|
+
else:
|
|
194
|
+
agent_logging_config = _get_agent_logging_config(
|
|
195
|
+
agent_logging_config_path, agent_logging_config_string
|
|
196
|
+
)
|
|
174
197
|
if (
|
|
175
198
|
agent_token
|
|
176
199
|
or deployment
|
|
@@ -203,6 +226,22 @@ def run(
|
|
|
203
226
|
user_code_launcher_module,
|
|
204
227
|
user_code_launcher_class,
|
|
205
228
|
user_code_launcher_config,
|
|
229
|
+
agent_logging_config,
|
|
206
230
|
)
|
|
207
231
|
else:
|
|
208
|
-
run_local_agent_in_environment(dagster_home,
|
|
232
|
+
run_local_agent_in_environment(dagster_home, agent_logging_config)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _get_agent_logging_config(
|
|
236
|
+
agent_logging_config_path: Optional[Path],
|
|
237
|
+
agent_logging_config_string: Optional[str],
|
|
238
|
+
) -> Optional[Mapping[str, object]]:
|
|
239
|
+
agent_logging_config: Optional[Mapping[str, object]] = None
|
|
240
|
+
if agent_logging_config_path:
|
|
241
|
+
agent_logging_config = cast(
|
|
242
|
+
"Mapping[str, object]",
|
|
243
|
+
load_yaml_from_globs(str(agent_logging_config_path)),
|
|
244
|
+
)
|
|
245
|
+
elif agent_logging_config_string:
|
|
246
|
+
agent_logging_config = json.loads(agent_logging_config_string)
|
|
247
|
+
return agent_logging_config
|