Skip to content

Commit 18bdce3

Browse files
author
Daniel Gibson
committed
fix azure tests
64;2500;0c > Insert changelog entry or delete this section. Don't delete keys before overwriting in azure blob IO manager Summary: The fact that this sets overwrite=True makes me strongly suspect that this is safe, but the relevant test is disabled :( https://github.com/dagster-io/dagster/blob/97b7bfae8d9dbfb49daaf76c58932dd2fb55b6bd/python_modules/libraries/dagster-azure/dagster_azure_tests/adls2_tests/test_io_manager.py#L237-L242 Need to figure out how to get it working. TBD > Insert changelog entry or delete this section.
1 parent 02a8ad8 commit 18bdce3

2 files changed

Lines changed: 12 additions & 41 deletions

File tree

python_modules/libraries/dagster-azure/dagster_azure/adls2/io_manager.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ def load_from_path(self, context: InputContext, path: UPath) -> Any:
105105
return pickle.loads(stream.readall())
106106

107107
def dump_to_path(self, context: OutputContext, obj: Any, path: UPath) -> None:
108-
if self.path_exists(path):
109-
context.log.warning(f"Removing existing ADLS2 key: {path}")
110-
self.unlink(path)
111-
112108
pickled_obj = pickle.dumps(obj, PICKLE_PROTOCOL)
113109
file = self.file_system_client.create_file(path.as_posix())
114110
with self._acquire_lease(file) as lease:

python_modules/libraries/dagster-azure/dagster_azure_tests/adls2_tests/test_io_manager.py

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
from dagster._core.definitions.assets.definition.assets_definition import AssetsDefinition
2424
from dagster._core.definitions.definitions_class import Definitions
2525
from dagster._core.definitions.job_base import InMemoryJob
26-
from dagster._core.definitions.partitions.definition import StaticPartitionsDefinition
27-
from dagster._core.definitions.source_asset import SourceAsset
2826
from dagster._core.definitions.unresolved_asset_job_definition import define_asset_job
2927
from dagster._core.events import DagsterEventType
3028
from dagster._core.execution.api import create_execution_plan, execute_plan
@@ -81,10 +79,6 @@ def basic_external_plan_execution():
8179

8280

8381
@pytest.mark.nettest
84-
@pytest.mark.skip(
85-
"Blob this depends on does not exist. See"
86-
" https://linear.app/elementl/issue/CORE-83/test-adls2-pickle-io-manager-deletes-recursively-disabled-reenable-it"
87-
)
8882
def test_adls2_pickle_io_manager_deletes_recursively(storage_account, file_system, credential):
8983
job = define_inty_job()
9084

@@ -151,10 +145,6 @@ def test_adls2_pickle_io_manager_deletes_recursively(storage_account, file_syste
151145

152146

153147
@pytest.mark.nettest
154-
@pytest.mark.skip(
155-
"Blob this depends on does not exist. See"
156-
" https://linear.app/elementl/issue/CORE-83/test-adls2-pickle-io-manager-deletes-recursively-disabled-reenable-it"
157-
)
158148
def test_adls2_pickle_io_manager_execution(storage_account, file_system, credential):
159149
job = define_inty_job()
160150

@@ -235,10 +225,7 @@ def test_adls2_pickle_io_manager_execution(storage_account, file_system, credent
235225
assert io_manager.load_input(context) == 2
236226

237227

238-
@pytest.mark.skip(
239-
"Blob this depends on does not exist. See"
240-
" https://linear.app/elementl/issue/CORE-83/test-adls2-pickle-io-manager-deletes-recursively-disabled-reenable-it"
241-
)
228+
@pytest.mark.nettest
242229
def test_asset_io_manager(storage_account, file_system, credential):
243230
# if you add new assets to this test, make sure that the output names include _id so that we don't
244231
# run into issues with the azure leasing system in CI
@@ -261,37 +248,20 @@ def graph_asset():
261248

262249
@asset(
263250
name=f"upstream_{_id}",
264-
ins={"asset3": AssetIn(asset_key=AssetKey([f"asset3_{_id}"]))}, # pyright: ignore[reportCallIssue]
251+
ins={"asset3": AssetIn(key=AssetKey([f"asset3_{_id}"]))},
265252
)
266253
def upstream(asset3):
267254
return asset3 + 1
268255

269-
SourceAsset(f"source1_{_id}", partitions_def=StaticPartitionsDefinition(["foo", "bar"]))
270-
271-
# prepopulate storage with source asset
272-
io_manager = PickledObjectADLS2IOManager(
273-
file_system=file_system,
274-
adls2_client=create_adls2_client(storage_account, credential),
275-
blob_client=create_blob_client(storage_account, credential),
276-
lease_client_constructor=DataLakeLeaseClient,
277-
)
278-
for partition_key in ["foo", "bar"]:
279-
context = build_output_context(
280-
step_key=f"source1_{_id}",
281-
name="result",
282-
run_id=make_new_run_id(),
283-
dagster_type=resolve_dagster_type(int),
284-
partition_key=partition_key,
285-
)
286-
io_manager.handle_output(context, 1)
287-
288256
@asset(
289257
name=f"downstream_{_id}",
290-
ins={"upstream": AssetIn(asset_key=AssetKey([f"upstream_{_id}"]))}, # pyright: ignore[reportCallIssue]
258+
ins={
259+
"upstream": AssetIn(key=AssetKey([f"upstream_{_id}"])),
260+
},
291261
)
292-
def downstream(upstream, source):
262+
def downstream(upstream):
293263
assert upstream == 7
294-
return 1 + upstream + source["foo"] + source["bar"]
264+
return 1 + upstream
295265

296266
asset_job = Definitions(
297267
assets=[upstream, downstream, AssetsDefinition.from_graph(graph_asset)],
@@ -314,6 +284,11 @@ def downstream(upstream, source):
314284
result = asset_job.execute_in_process(run_config=run_config)
315285
assert result.success
316286

287+
# overwriting the same bucket still works
288+
289+
result = asset_job.execute_in_process(run_config=run_config)
290+
assert result.success
291+
317292

318293
def test_with_fake_adls2_resource():
319294
job = define_inty_job(adls_io_resource=fake_adls2_resource)

0 commit comments

Comments
 (0)