Giter Site home page Giter Site logo

fusedio / udfs Goto Github PK

View Code? Open in Web Editor NEW
163.0 7.0 30.0 4.84 MB

Public Fused UDFs. Build any scale workflows with the Fused Python SDK and Workbench webapp, and integrate them into your stack with the Fused Hosted API.

Home Page: https://www.fused.io

License: MIT License

Python 100.00%
geospatial python udf geospatial-analysis data-science earth-observation geopython gis raster spatial

udfs's People

Contributors

alexlowellmartin avatar charlesfused avatar cheginit avatar chelm avatar fhk avatar fused-io-staging[bot] avatar gdurkin avatar gsueur avatar isaacbrodsky avatar kashuk avatar kylebarron avatar luke2019-eng avatar mbforr avatar mehran66 avatar milind-soni avatar mletic avatar ncray avatar pgzmnk avatar samlalwani avatar tylere avatar yashbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

udfs's Issues

Greetings from Xarray-Spatial

Hello udfs,

This is xarray-spatial stopping by to say we've recently updated to work with Python 3.12 which was an overdue change.

I see here that xarray-spatial is a dependency for udfs, feel free to reach out if you'd like to bounce around ideas or feature requests for xrspatial.

Hope all is swell with y'all and keep up the great work!

Sincerely,

Xarray Spatial

AWS credentials as environment variables not working as expected

I'm trying to load private data from S3 in a fused UDF, and I want to make sure I'm doing it the "right" way.

I'm trying to follow these instructions: https://docs.fused.io/basics/utilities/#environment-variables
In one UDF, I've got this:

env_vars = """
AWS_ACCESS_KEY_ID=AK...
AWS_SECRET_ACCESS_KEY=Gt...
"""

# Path to your .env file
env_file_path = '/mnt/cache/.env'

@fused.udf
def udf(bbox=None, n=10):
    # Writing the environment variables to the .env file
    with open(env_file_path, 'w') as file:
        file.write(env_vars)

In the second UDF I've got this.

@fused.udf
def udf():
    import os

    import boto3
    from dotenv import load_dotenv

    # Load environment variable
    env_file_path = '/mnt/cache/.env'
    load_dotenv(env_file_path, override=True)
    
    # these are being set correctly
    assert os.environ['AWS_ACCESS_KEY_ID'] == 'AK...'
    assert os.environ['AWS_SECRET_ACCESS_KEY'] == 'Gt...'

    # doesn't work
    # botocore.exceptions.ClientError: An error occurred (InvalidToken) when calling the GetObject operation: The provided token is malformed or otherwise invalid.
    # s3 credentials not detected correctly from environment
    # s3 = boto3.client('s3')

    # does work if I explicitly pass the credentials
    s3 = boto3.client(
        's3',
        aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'],
        aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY']
    )

    bucket="arraylake-earthmover-production"
    key="6462e90c27af040cabc066e8/chunks/0081af97634c03fc1c3fcd16b1f3c196558c15c096674f5a0052bf25479d0e8b.00000000000000000000000000000000"
    obj = s3.get_object(Bucket=bucket, Key=key)
    print(obj)

In most normal Python environments, boto3 will automatically get the credentials from the environment variables without having to pass them explicitly (see https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#environment-variables). However, in the fused UDF, this is not working for some reason, and if I don't pass the credentials explicitly, I get the "The provided token is malformed or otherwise invalid" error.

This is obviously not a huge problem. The workaround--explicitly passing the credentials--is easy enough. But I thought I would open this issue to try to understand better what is going on here.

sample notebook failure

Not a blocker, just looking around.

Tried out the notebook instructions from the docs:

udf = fused.load("https://github.com/fusedio/udfs/tree/main/public/LULC_Tile_Example")
arr = fused.run(udf=udf, x=5241, y=12667, z=15)

And got this failure:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-2-e0f60be8a49e>](https://dnyjr4pdoe-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240711-060152_RC00_651359636#) in <cell line: 4>()
      2 
      3 udf = fused.load("https://github.com/fusedio/udfs/tree/main/public/LULC_Tile_Example")
----> 4 arr = fused.run(udf=udf, x=5241, y=12667, z=15)
      5 arr

5 frames
<string> in udf(bbox, context, year)

<string> in bbox_stac_items(bbox, table)

[/usr/local/lib/python3.10/dist-packages/fused/core/_impl/_table_ops_impl.py](https://dnyjr4pdoe-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240711-060152_RC00_651359636#) in get_chunks_metadata(url)
     32         or sample_metadata.metadata[b"fused:format_version"] != b"5"
     33     ):
---> 34         raise ValueError(
     35             "Dataset does not have Fused metadata or it is an incompatible version."
     36         )

ValueError: Dataset does not have Fused metadata or it is an incompatible version.

Here is the notebook:

https://colab.research.google.com/drive/1H6hZJSJ-P7k1ABbcXcb39l_Vg959WVzQ?usp=sharing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.