(store SparkFileStore)
| 942 | } |
| 943 | |
| 944 | func (s *SparkGenericExecutor) InitializeExecutor(store SparkFileStore) error { |
| 945 | s.logger.Info("Uploading PySpark script to filestore") |
| 946 | // We can't use CreateFilePath here because it calls Validate under the hood, |
| 947 | // which will always fail given it's a local file without a valid scheme or bucket, for example. |
| 948 | sparkLocalScriptPath := &filestore.LocalFilepath{} |
| 949 | if err := sparkLocalScriptPath.SetKey(config.GetSparkLocalScriptPath()); err != nil { |
| 950 | return fmt.Errorf("could not create local script path: %v", err) |
| 951 | } |
| 952 | |
| 953 | sparkRemoteScriptPath, err := store.CreateFilePath(config.GetSparkRemoteScriptPath()) |
| 954 | if err != nil { |
| 955 | return fmt.Errorf("could not create file path: %v", err) |
| 956 | } |
| 957 | |
| 958 | err = readAndUploadFile(sparkLocalScriptPath, sparkRemoteScriptPath, store) |
| 959 | if err != nil { |
| 960 | return fmt.Errorf("could not upload '%s' to '%s': %v", sparkLocalScriptPath.Key(), sparkRemoteScriptPath.ToURI(), err) |
| 961 | } |
| 962 | scriptExists, err := store.Exists(sparkRemoteScriptPath) |
| 963 | if err != nil || !scriptExists { |
| 964 | return fmt.Errorf("could not upload spark script: Path: %s, Error: %v", sparkRemoteScriptPath.ToURI(), err) |
| 965 | } |
| 966 | return nil |
| 967 | } |
| 968 | |
| 969 | func (s *SparkGenericExecutor) getYarnCommand(args string) (string, error) { |
| 970 | configDir, err := os.MkdirTemp("", "hadoop-conf") |
nothing calls this directly
no test coverage detected