-
Notifications
You must be signed in to change notification settings - Fork 58
Use sourceDir and handler to build functions #470
Conversation
@@ -13,7 +13,7 @@ | |||
dispatch create image python3 python3 | |||
|
|||
Create a function: | |||
dispatch create function python3 hello-python examples/python3/hello.py | |||
dispatch create function --image=python3 hello-python examples/python3 --handler=hello.handle |
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.
I really, really want to also preserve the existing support for simply specifying a filename as a function (without handler). If I specify a single file (i.e. examples/python3/hello.py) it should be implicit that we are going to use --handler hello.handle. We don't even need to do anything fancy to support this, it could all be hidden in the CLI.
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.
OK, I still haven't had my coffee :). But the CLI could take care of simply tar'ing up a single file in the "current" usage pattern, but the base image would likely have to call the "default handler" as it's very language specific. Anyway, I'd like to gauge the effort required to support this.
@@ -149,7 +149,7 @@ In order to create the *image*, **Dispatch image manager** does the following: | |||
|
|||
A **user** creates a *function* from a source file using the specified *image*: | |||
|
|||
$ dispatch create function js-deps hello1 ./hello.js | |||
$ dispatch create function --image=js-deps hello1 . --handler=./hello.js | |||
|
|||
Here, the *function* named `hello1` is created from the source file `./hello.js` using the image `js-deps` containing library packages that can be used by the *function*. |
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 probably mention that you are using the current directory as source files for the function.
Run: func(cmd *cobra.Command, args []string) { | ||
err := createFunction(out, errOut, cmd, args) | ||
CheckErr(err) | ||
}, | ||
} | ||
cmd.Flags().StringVar(&depsImage, "image", "", "REQUIRED: image to build function on") |
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.
Might want to add:
cmd.MarkFlagRequired("image")
cmd.MarkFlagRequired("handler")
Get rid of Exec when creating functions and building function images. Build function images *before* calling faasDriver.Create(). Write the source dir. rm function.Code field. Move TarDir and Untar to tar.go Add TarGzBytes() to utils/tar.go CLI: create function. Function.sourcePath for seed.yaml TarDir to correctly normalize paths. Migrate e2e tests.
Implement #416
Get rid of Exec when creating functions and building function images.
Build function images before calling faasDriver.Create().
Write the source dir.
rm function.Code field.
Move TarDir and Untar to tar.go
Add TarGzBytes() to utils/tar.go
CLI: create function.
Function.sourcePath for seed.yaml
TarDir to correctly normalize paths.
Migrate e2e tests.