https://dagster.io/ logo
#ask-ai
Title
# ask-ai
m

Martin Peak

03/04/2024, 4:05 AM
whats the code to setup an ssh resource when using dagster-ssh?
s

Scout

03/04/2024, 4:05 AM
To set up an SSH resource when using
dagster-ssh
, you can define an asset and use the
with_resources
function to attach the SSH resource to it. Here's an example code snippet from the documentation:
Copy code
python from dagster import asset, with_resources from dagster_ssh import ssh_resource  @asset(required_resource_keys={'ssh'}) def my_asset(context):     context.resources.ssh.sftp_get("/path/to/remote.csv", "path/to/local.csv")  assets = with_resources([my_asset], resource_defs={     'ssh': ssh_resource.configured({         'remote_host': '<http://foo.com|foo.com>',         'key_file': 'path/to/id_rsa',     }) })
In this example, the
my_asset
asset requires an SSH resource, which is provided by configuring the
ssh_resource
with the necessary parameters such as
remote_host
and
key_file
. The
with_resources
function is then used to bind the resource definition to the asset.
2 Views