Skip to content

Commit

Permalink
Update create.go (kubeflow#1207)
Browse files Browse the repository at this point in the history
Allow specifying a prefix for bucket uploads
  • Loading branch information
bribroder authored Mar 25, 2021
1 parent 6f66e3f commit fb4f23a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sparkctl/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import (
)

const bufferSize = 1024
const rootPath = "spark-app-dependencies"

var RootPath string
var UploadToPath string
var UploadToEndpoint string
var UploadToRegion string
Expand Down Expand Up @@ -90,7 +90,9 @@ var createCmd = &cobra.Command{

func init() {
createCmd.Flags().StringVarP(&UploadToPath, "upload-to", "u", "",
"a URL of the remote location where local application dependencies are to be uploaded to")
"the name of the bucket where local application dependencies are to be uploaded")
createCmd.Flags().StringVarP(&RootPath, "upload-prefix", "p", "",
"the prefix to use for the dependency uploads")
createCmd.Flags().StringVarP(&UploadToRegion, "upload-to-region", "r", "",
"the GCS or S3 storage region for the bucket")
createCmd.Flags().StringVarP(&UploadToEndpoint, "upload-to-endpoint", "e",
Expand Down Expand Up @@ -390,7 +392,7 @@ func uploadLocalDependencies(app *v1beta2.SparkApplication, files []string) ([]s
}

var uploadedFilePaths []string
uploadPath := filepath.Join(rootPath, app.Namespace, app.Name)
uploadPath := filepath.Join(RootPath, app.Namespace, app.Name)
for _, localFilePath := range files {
uploadFilePath, err := uh.uploadToBucket(uploadPath, localFilePath)
if err != nil {
Expand Down

0 comments on commit fb4f23a

Please sign in to comment.