Skip to content

Conversation

dthain
Copy link
Member

@dthain dthain commented Nov 7, 2024

Proposed Changes

Add capability to add symlink to task sandbox namespace.
Will then add mode to substitute regular file objects with symlinks to shared filesystem.

Merge Checklist

The following items must be completed before PRs can be merge.
Check these off to verify you have completed all steps.

  • make test Run local tests prior to pushing.
  • make format Format source code to comply with lint policies. Note that some lint errors can only be resolved manually (e.g., Python)
  • make lint Run lint on source code prior to pushing.
  • Manual Update Update the manual to reflect user-visible changes.
  • Type Labels Select a github label for the type: bugfix, enhancement, etc.
  • Product Labels Select a github label for the product: TaskVine, Makeflow, etc.
  • PR RTM Mark your PR as ready to merge.

@tphung3 tphung3 requested a review from Copilot September 22, 2025 18:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new symlink capability to TaskVine, allowing tasks to create symlinks within their sandbox namespace for accessing shared filesystem resources. The implementation replaces the previous symlink flag behavior (now uses hardlink instead) and introduces dedicated symlink functionality that bypasses TaskVine's caching infrastructure.

Key changes:

  • Introduces vine_symlink structure and related functions for managing symlinks
  • Adds add_symlink method to tasks for creating arbitrary symlinks in task sandboxes
  • Changes default file mounting behavior to use symlinks instead of hardlinks, with explicit hardlink flag for when needed

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
taskvine/test/vine_python.py Updates test to use hardlink flag and adds new symlink test case
taskvine/src/worker/vine_worker.c Adds protocol parsing for symlink commands
taskvine/src/worker/vine_sandbox.c Implements symlink creation in sandbox staging and reverses mount behavior
taskvine/src/manager/vine_task.h Adds symlink_list field to task structure
taskvine/src/manager/vine_task.c Implements symlink list management and adds vine_task_add_symlink function
taskvine/src/manager/vine_symlink.h Defines vine_symlink structure and function declarations
taskvine/src/manager/vine_symlink.c Implements vine_symlink creation, copying, and deletion functions
taskvine/src/manager/vine_manager_put.c Adds protocol generation for sending symlink commands to workers
taskvine/src/manager/taskvine.h Updates API documentation and mount flag definitions
taskvine/src/manager/Makefile Adds vine_symlink.c to build sources
taskvine/src/bindings/python3/ndcctools/taskvine/task.py Updates Python bindings to use hardlink flag instead of symlink flag

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +147 to +148
t.add_symlink("input","infile" )
t.add_symlink("output","outfile" )
Copy link
Preview

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

The symlink targets "infile" and "outfile" appear to be undefined variables or paths. These should be valid absolute paths to existing files in the shared filesystem for the symlinks to work correctly.

Suggested change
t.add_symlink("input","infile" )
t.add_symlink("output","outfile" )
t.add_symlink("input", input_file)
t.add_symlink("output", path.join(test_dir, "outs", output_name))

Copilot uses AI. Check for mistakes.

Comment on lines +158 to +162
result = symlink(s->target, s->name);
if (result != 0) {
debug(D_VINE, "unable to symlink %s -> %s: %s", s->name, s->target, strerror(errno));
break;
}
Copy link
Preview

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

The success condition check is incorrect. The symlink() function returns 0 on success and -1 on failure. The current logic treats success (0) as failure and will break the loop on the first successful symlink creation.

Copilot uses AI. Check for mistakes.

Comment on lines +1 to +2

#include "vine_symlink.h"
Copy link
Preview

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

Missing copyright header. The file should include the standard copyright notice consistent with other files in the codebase.

Copilot uses AI. Check for mistakes.

raise TypeError(f"remote_name {remote_name} is not a str")

flags = Task._determine_mount_flags(strict_input=strict_input, mount_symlink=mount_symlink)
flags = Task._determine_mount_flags(strict_input=strict_input,mount_hardlink=mount_hardlink)
Copy link
Preview

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing space after comma in function call. Should be mount_hardlink=mount_hardlink with proper spacing.

Suggested change
flags = Task._determine_mount_flags(strict_input=strict_input,mount_hardlink=mount_hardlink)
flags = Task._determine_mount_flags(strict_input=strict_input, mount_hardlink=mount_hardlink)

Copilot uses AI. Check for mistakes.

# >>> task.add_input(f,"data")
# @endcode
def add_input(self, file, remote_name, strict_input=False, mount_symlink=False):
def add_input(self, file, remote_name, strict_input=False, mount_hardlink=False ):
Copy link
Preview

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

[nitpick] Extra space before the closing parenthesis. Should be mount_hardlink=False) without the trailing space.

Suggested change
def add_input(self, file, remote_name, strict_input=False, mount_hardlink=False ):
def add_input(self, file, remote_name, strict_input=False, mount_hardlink=False):

Copilot uses AI. Check for mistakes.

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