-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: add python runtime and plugin #3181
Conversation
@@ -103,7 +103,7 @@ func generateStubsForEachLanguage(ctx context.Context, projectRoot string, modul | |||
} | |||
err := wg.Wait() | |||
if err != nil { | |||
return fmt.Errorf("failed to generate go stubs: %w", err) | |||
return fmt.Errorf("failed to generate language stubs: %w", 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.
🫡
3447cbb
to
036fc20
Compare
c5bc937
to
1023df3
Compare
37c6b67
to
ce1d013
Compare
ce1d013
to
68e3158
Compare
68e3158
to
adc1285
Compare
dd4fb2d
to
dcedd97
Compare
8c5c832
to
b925d23
Compare
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.
We'll also need to add Python to the ftl-runner Docker image.
@@ -0,0 +1,58 @@ | |||
package main |
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.
This should be in python-runtime/cmd/ftl-language-python/main.go
logger.Infof("ftl-language-python starting up") | ||
|
||
// Handle signals. | ||
sigch := make(chan os.Signal, 1) | ||
signal.Notify(sigch, syscall.SIGINT, syscall.SIGTERM) | ||
go func() { | ||
sig := <-sigch | ||
logger.Debugf("ftl-language-python terminating with signal %s", sig) | ||
cancel() | ||
_ = syscall.Kill(-syscall.Getpid(), sig.(syscall.Signal)) //nolint:forcetypeassert,errcheck // best effort | ||
os.Exit(0) | ||
}() | ||
|
||
kctx.BindTo(ctx, (*context.Context)(nil)) | ||
|
||
svc := pythonplugin.New() | ||
logger.Infof("ftl-language-python starting to serve on %v", cli.Bind) | ||
err := rpc.Serve(ctx, | ||
cli.Bind, | ||
rpc.GRPC(languagepbconnect.NewLanguageServiceHandler, svc), | ||
rpc.PProf(), | ||
) | ||
logger.Errorf(err, "ftl-language-python stopped serving") | ||
kctx.FatalIfErrorf(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.
This should be using internal/plugin.Start()
, which handles all this for you automatically.
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.
Awesome! I'll check with @matt2e too and we can update the goplugin branch as well. Thanks!
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.
No description provided.