Skip to content

Add serverless provisioner - #16185

Draft
sahusanket wants to merge 1 commit into
developfrom
serverless_poc_2026
Draft

Add serverless provisioner#16185
sahusanket wants to merge 1 commit into
developfrom
serverless_poc_2026

Conversation

@sahusanket

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for Dataproc Serverless by adding the DataprocServerlessProvisioner, DataprocServerlessRuntimeJobManager, configuration metadata, and corresponding unit tests. Feedback on the changes highlights three critical issues in DataprocServerlessRuntimeJobManager: a potential NullPointerException in validateDeleteLifecycle if the GCS bucket does not exist, a bypass of the configured Storage client in openStream, and a temporary directory leak in /tmp when local caching is disabled.

Comment on lines +436 to +439
private boolean validateDeleteLifecycle(String bucketName, String run) {
Storage storage = getStorageClient();
Bucket bucket = storage.get(bucketName);
for (BucketInfo.LifecycleRule rule : bucket.getLifecycleRules()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

If the GCS bucket does not exist or is inaccessible, storage.get(bucketName) will return null. Accessing bucket.getLifecycleRules() without a null check will throw a NullPointerException. A null check should be added to handle this defensively.

  private boolean validateDeleteLifecycle(String bucketName, String run) {
    Storage storage = getStorageClient();
    Bucket bucket = storage.get(bucketName);
    if (bucket == null) {
      return false;
    }
    for (BucketInfo.LifecycleRule rule : bucket.getLifecycleRules()) {

Comment on lines +576 to +580
if ("gs".equals(uri.getScheme())) {
BlobId blobId = BlobId.of(uri.getAuthority(), uri.getPath().substring(1));
Storage client = StorageOptions.getDefaultInstance().getService();
return Channels.newInputStream(client.get(blobId).reader());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Using StorageOptions.getDefaultInstance().getService() bypasses the configured Storage client (which has custom credentials, project ID, timeouts, and retry settings). This can lead to authentication/authorization failures or connection timeouts in environments where default credentials are not configured or differ from the provisioner's credentials. Use getStorageClient() instead.

Suggested change
if ("gs".equals(uri.getScheme())) {
BlobId blobId = BlobId.of(uri.getAuthority(), uri.getPath().substring(1));
Storage client = StorageOptions.getDefaultInstance().getService();
return Channels.newInputStream(client.get(blobId).reader());
}
if ("gs".equals(uri.getScheme())) {
BlobId blobId = BlobId.of(uri.getAuthority(), uri.getPath().substring(1));
Storage client = getStorageClient();
return Channels.newInputStream(client.get(blobId).reader());
}

Comment on lines +335 to +337
if (disableLocalCaching) {
DataprocUtils.deleteDirectoryContents(tempDir);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When disableLocalCaching is enabled, a temporary directory is created using Files.createTempDirectory. However, DataprocUtils.deleteDirectoryContents(tempDir) only deletes the files and subdirectories inside it, leaving the empty temporary directory itself behind. This causes a directory leak in /tmp. Call tempDir.delete() after deleting its contents to clean up the directory itself.

      if (disableLocalCaching) {
        DataprocUtils.deleteDirectoryContents(tempDir);
        tempDir.delete();
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant