Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 45
Cleaning exospherehost python sdk and adding first exospherehost runtime#141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
76a002c80e9204d3bd71a0bcfc1b5a4115e177f567c5de4ea91b13cc35ba94875762f83f49860File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
| .Python | ||
| build/ | ||
| develop-eggs/ | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| wheels/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
| # Virtual Environment | ||
| venv/ | ||
| env/ | ||
| ENV/ | ||
| .env | ||
| .venv/ | ||
| # IDE | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
| .idea/ | ||
| *.iws | ||
| *.iml | ||
| *.ipr | ||
| # Local development | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
| # Database | ||
| *.db | ||
| *.sqlite3 | ||
| # OS generated files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
| #logs | ||
| *.log | ||
| logs/*.* | ||
| !logs/.gitkeep | ||
| # local files | ||
| files/ | ||
| !files/.gitkeep |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.12 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| from dotenv import load_dotenv | ||
| from exospherehost import Runtime | ||
| from nodes.list_s3_files import ListS3FilesNode | ||
| # Load environment variables from .env file | ||
| # EXOSPHERE_STATE_MANAGER_URI is the URI of the state manager | ||
| # EXOSPHERE_API_KEY is the key of the runtime | ||
| load_dotenv() | ||
| Runtime( | ||
| name="cloud-storage-runtime", | ||
| namespace="exospherehost", | ||
| nodes=[ListS3FilesNode] | ||
| ).start() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import boto3 | ||
| import os | ||
| from exospherehost import BaseNode | ||
| from typing import List | ||
| from pydantic import BaseModel | ||
| class ListS3FilesNode(BaseNode): | ||
| class Inputs(BaseModel): | ||
| bucket_name: str | ||
| prefix: str = '' | ||
| files_only: bool = False | ||
| recursive: bool = False | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| class Outputs(BaseModel): | ||
| key: str | ||
| class Secrets(BaseModel): | ||
| aws_access_key_id: str = os.getenv("S3_ACCESS_KEY_ID") | ||
| aws_secret_access_key: str = os.getenv("S3_SECRET_ACCESS_KEY") | ||
| aws_region: str = os.getenv("S3_REGION") | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| async def execute(self) -> List[Outputs]: | ||
| print(self.inputs) | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| s3_client = boto3.client( | ||
| 's3', | ||
| aws_access_key_id=os.getenv("S3_ACCESS_KEY_ID"), | ||
| aws_secret_access_key=os.getenv("S3_SECRET_ACCESS_KEY"), | ||
| region_name=os.getenv("S3_REGION") | ||
| ) | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| response = s3_client.list_objects_v2(Bucket=self.inputs.bucket_name, Prefix=self.inputs.prefix) | ||
| return [ | ||
| self.Outputs(key=data['Key']) | ||
| for data in response['Contents'] | ||
| ] | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [project] | ||
| name = "cloud-storage-runtime" | ||
| version = "0.1.0" | ||
| description = "Add your description here" | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| readme = "README.md" | ||
| requires-python = ">=3.12" | ||
NiveditJain marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| dependencies = [ | ||
| "boto3>=1.40.1", | ||
| "python-dotenv>=1.1.1", | ||
| ] | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.