cuddly-jelly-27016
08/13/2023, 5:33 AMimport asyncio
from typing import Optional, TypeVar
from flytekit import FlyteContextManager
from flytekit.sensor.base_sensor import BaseSensor
T = TypeVar("T")
class FileSensor(BaseSensor):
def __init__(self, name: str, config: Optional[T] = None, **kwargs):
super().__init__(name=name, sensor_config=config, **kwargs)
async def poke(self, path: str) -> bool:
fs = FlyteContextManager.current_context().file_access.get_filesystem_for_path(path, asynchronous=True)
return await asyncio.to_thread(fs.exists, path)
Tracking Issue
flyteorg/flyte#3936
Follow-up issue
NA
flyteorg/flytekit
GitHub Actions: build-plugins (3.8, flytekit-k8s-pod)
GitHub Actions: build-plugins (3.8, flytekit-huggingface)
GitHub Actions: build-plugins (3.8, flytekit-hive)
GitHub Actions: build-plugins (3.8, flytekit-greatexpectations)
GitHub Actions: build-plugins (3.8, flytekit-envd)
GitHub Actions: build-plugins (3.8, flytekit-duckdb)
GitHub Actions: build-plugins (3.8, flytekit-dolt)
GitHub Actions: build-plugins (3.8, flytekit-deck-standard)
GitHub Actions: build-plugins (3.8, flytekit-dbt)
GitHub Actions: build-plugins (3.8, flytekit-data-fsspec)
GitHub Actions: build-plugins (3.8, flytekit-dask)
GitHub Actions: build-plugins (3.8, flytekit-bigquery)
GitHub Actions: build-plugins (3.8, flytekit-aws-sagemaker)
GitHub Actions: build-plugins (3.8, flytekit-aws-batch)
GitHub Actions: build-plugins (3.8, flytekit-aws-athena)
✅ 15 other checks have passed
15/30 successful checksacoustic-carpenter-78188
08/23/2023, 5:41 PM