-
Notifications
You must be signed in to change notification settings - Fork 42
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
Merged
NiveditJain
merged 11 commits into
exospherehost:main
from
NiveditJain:bringing-it-all-together
Aug 4, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
76a002c
minor change in api server
NiveditJain 80e9204
cleaned Node Creation logic
NiveditJain d3bd71a
fixing runtime and BaseNode
NiveditJain 0bcfc1b
fixed errors
NiveditJain 5a4115e
fixed docstings
NiveditJain 177f567
Add initial implementation of cloud-storage-runtime
NiveditJain c5de4ea
version updated
NiveditJain 91b13cc
Merge branch 'main' into bringing-it-all-together
NiveditJain 35ba948
fixed README
NiveditJain 75762f8
Merge branch 'bringing-it-all-together' of https://github.com/Nivedit…
NiveditJain 3f49860
fixed issues pointed by @coderabbitai
NiveditJain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.12 | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
Empty file.
39 changes: 39 additions & 0 deletions
39
exosphere-runtimes/cloud-storage-runtime/nodes/list_s3_files.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
Show resolved
Hide resolved
|
||
|
|
||
| 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.
Show resolved
Hide resolved
|
||
|
|
||
| async def execute(self) -> List[Outputs]: | ||
| print(self.inputs) | ||
NiveditJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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.
Show resolved
Hide resolved
|
||
| 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.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
Show resolved
Hide resolved
|
||
| readme = "README.md" | ||
| requires-python = ">=3.12" | ||
NiveditJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.