-
Notifications
You must be signed in to change notification settings - Fork 76
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
New Registry Commands #1148
New Registry Commands #1148
Conversation
First few commands complete. Want to add a few more quality-of-life things, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fritz - this is fantastic. Super small changes overall but thank you!
cmd/registry/root.go
Outdated
return getProviderUrl.String() | ||
} | ||
|
||
func getProviderRoute(providerId string, providerVersion string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func getProviderRoute(providerId string, providerVersion string) string { | |
func getProviderRoute(providerName string, providerVersion string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The airflow schema refers to apache-airflow-provider-snowflake as a "provider package name" and amazon would be the "provider name". see here: https://github.com/apache/airflow/blob/main/airflow/provider_info.schema.json
cmd/registry/root.go
Outdated
getProviderUrl := url.URL{ | ||
Scheme: "https", | ||
Host: registryHost, | ||
Path: fmt.Sprintf("%s/%s", registryApi, fmt.Sprintf(providerRoute, providerId, providerVersion)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path: fmt.Sprintf("%s/%s", registryApi, fmt.Sprintf(providerRoute, providerId, providerVersion)), | |
Path: fmt.Sprintf("%s/%s", registryApi, fmt.Sprintf(providerRoute, providerName, providerVersion)), |
Feedback notes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor copy review
Future work:
|
0a1b108
to
71bce22
Compare
Co-authored-by: Ian Moritz <ian@alkeri.com>
Co-authored-by: Ian Moritz <ian@alkeri.com>
Co-authored-by: Jake Witz <74574233+jwitz@users.noreply.github.com>
Co-authored-by: Jake Witz <74574233+jwitz@users.noreply.github.com>
71bce22
to
acf48e2
Compare
a345133
to
aa74304
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1148 +/- ##
==========================================
- Coverage 87.51% 87.28% -0.23%
==========================================
Files 110 113 +3
Lines 12999 13160 +161
==========================================
+ Hits 11376 11487 +111
- Misses 949 986 +37
- Partials 674 687 +13
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some minor comments around simplifying the logic to improve readability, LGTM otherwise
Co-authored-by: Neel Dalsania <neel.dalsania@astronomer.io>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work and thanks for the contribution, this would be quite useful for users. Code LGTM, has left some final nits to squash.
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defer f.Close() |
nit: file close should be part of defer so that it is called from any return point in the function. Sorry I might have missed it in my earlier review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter didn't like this because there are log.Fatal
's below. I also unfortunately can't run the linter locally for some reason, so that wasn't fun to find a configuration it was happy with, beyond what you see here. Does the line in this location pass the linter for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally, we shouldn't have log.Fatal(), but rather have it as log.Error() and then return the error from the function, and then the caller should handle the error and act accordingly.
The linter is complaining because as of now f.Close() even if in defer won't be called if there is any log.Fatal() after that in the code execution path. It's not a big issue if we are just missing out on f.Close(), but ideally in Golang we don't exit abruptly and handle errors everywhere, which makes it simpler to maintain in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense. I'll see if I can address that
} | ||
_, _ = fmt.Fprintf(out, "\nWrote %s to %s", providerString, filename) | ||
} | ||
_ = f.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ = f.Close() |
nit: not needed once we have it as defer
Co-authored-by: Neel Dalsania <neel.dalsania@astronomer.io>
filledDagRoute := fmt.Sprintf(dagRoute, dagID, dagVersion) | ||
getDagURL := url.URL{ | ||
Scheme: "https", | ||
Host: registryHost, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work only on prod env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't take a dev registry into account yet
@fritz-astronomer Do these commands need to run in an airflow project? If yes, we need to add that check. Something we do for |
@kushalmalani - they don't actually need to. They just add an entry to a |
Description
astro registry dag add dbt-basic --version 1.0.4
.py
) directly from the registry, at the filepath defined by the registry, optionally add any providers.astro registry provider add snowflake
requirements.txt
astro registry dev init https://github.com/astronomer/my-project/
init a project from the registry🧪 Functional Testing + 📸 Screenshots
registry_demo.mov
issue:
📋 Checklist
make test
before taking out of draftmake lint
before taking out of draft