Skip to content
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

Draft: create some apps from traitlet on startup #516

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Adam-D-Lewis
Copy link
Member

@Adam-D-Lewis Adam-D-Lewis commented Nov 6, 2024

Reference Issues or PRs

Contains some example code of how to pass in jhub apps to be run when Jhub apps starts up. You pass in the apps as a traitlet. They should be created if they don't exist.
Related to nebari-dev/nebari#2803

What does this implement/fix?

Put a x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

Documentation

Access-centered content checklist

Text styling

  • The content is written with plain language (where relevant).
  • If there are headers, they use the proper header tags (with only one level-one header: H1 or # in markdown).
  • All links describe where they link to (for example, check the Nebari website).
  • This content adheres to the Nebari style guides.

Non-text content

  • All content is represented as text (for example, images need alt text, and videos need captions or descriptive transcripts).
  • If there are emojis, there are not more than three in a row.
  • Don't use flashing GIFs or videos.
  • If the content were to be read as plain text, it still makes sense, and no information is missing.

Any other comments?

Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jhub-apps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2024 0:26am
jhub-apps-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2024 0:26am

jhub_apps/service/app.py Outdated Show resolved Hide resolved
@Adam-D-Lewis Adam-D-Lewis changed the title create apps on startup Draft of how we might create some apps from traitlet on startup Nov 7, 2024
@Adam-D-Lewis Adam-D-Lewis changed the title Draft of how we might create some apps from traitlet on startup Draft: create some apps from traitlet on startup Nov 7, 2024
@@ -58,3 +60,9 @@ class JAppsConfig(SingletonConfigurable):
None,
help="Disallow a set of frameworks to avoid spinning up apps using those frameworks",
).tag(config=True)

startup_apps = List(
trait=Any, # TODO: Change this, use Instance() maybe or define a new type - https://traitlets.readthedocs.io/en/stable/defining_traits.html
Copy link
Member Author

@Adam-D-Lewis Adam-D-Lewis Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just put this dict here for testing. I want to re-use the JHubAppConfig pydantic model somehow ideally.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should accept git repos here alternatively


def instantiate_startup_apps(user_options_list: list[dict[str, Any]], username: str):
# instantiate custom apps
for user_options_dict in user_options_list:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to add logic to only create the apps if they don't exist.

@aktech
Copy link
Member

aktech commented Nov 7, 2024

Thanks for the PR @Adam-D-Lewis, other than the gotchas to look for (as mentioned above), you're on the right path I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants