Skip to content
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

Addresses issue of assembly.zip contents not unzipped to current directory, preventing UDF failures by default. #622

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ object DotnetRunner extends Logging {
var zipFileName = args(0)
val zipFileUri = Try(new URI(zipFileName)).getOrElse(new File(zipFileName).toURI)
val workingDir = new File("").getAbsoluteFile
val driverDir = new File(workingDir, FilenameUtils.getBaseName(zipFileUri.getPath()))
//val driverDir = new File(workingDir, FilenameUtils.getBaseName(zipFileUri.getPath()))
// ZZ: By unzipping into the working directory, this ensures currentdir is the dir containing the files that is needed to properly handle UDF's, without the need to set ASSEMBLY_PATHS
// The alternative here would be to change current working directory to the subdirectory path, but that seems like it could have more unintended side effects
val driverDir = workingDir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious how extracting the zip file to the driver's current directory will allow the Microsoft.Spark.Worker to locate the udf assemblies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it expected that the working directory of the driver is accessible by the Microsoft.Spark.Worker that may be running on separate nodes in the cluster ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, the assumption I have is that the assembly.zip bundle in question would have the assemblies containing the UDF's. That's how we're using it. And having that in the working directory empirically works, where as if the assembly is unzipped to a subdirectory from the working directory, i.e. assembly/* does not (causes serialization errors). I don't know whether that's by intention or caused by some other side effect, but this is what we've observed.

The issue is that, if the assemblies are not in the same directory in which you're launch DotnetRunner, then UDF's don't get picked up (unless it's in the ASSEMBLY_SEARCH_PATH, which we won't be able to set conveniently). But if it's unzipped to the working directory for DotnetRunner, then the SEARCH PATH won't need to be set at all.

Hope that makes sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssemblyLoader.cs will set up the paths for the Worker to search for UDF assemblies. Unless the working directory of the Worker is set to the driver's working directory and is also accessible by the worker, then I don't know if this would be the proper fix. Have you been able to test this in cluster mode and/or in other big data platforms like HDInsight/Databricks ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zzhu-bh have you been able to test this PR in a spark cluster ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow up @suhsteve! Sorry, we have not been able to work on this, our teams have been putting out some fires. I'll see if I can get someone on the team to follow up on this issue. Thank you for your patience.


// Standalone cluster mode where .NET application is remotely located.
if (zipFileUri.getScheme() != "file") {
Expand Down