Skip to content

Optimize possible imports (projects) #4892

@Bubballoo3

Description

@Bubballoo3

Now that we are testing with a realistic SHARED_PROJECT_PATH configuration, I wonder if we can use some details of the assumed structure to make the scan for importable projects more effecient. There are two main strategies I can see.

  1. Use the find command to only get folders with */.ondemand/manifest.yml structure, and check for readability. This would certainly be faster, though I am not sure if
  • We can rely on the find command in all supported OS's
  • We can efficiently filter out 'Permission Denied' errors, which are the bulk of the output.
  1. Only look in writable directories (instead of readable). I am pretty sure after the mode discussion in add setgid option to projects #4872 (comment) that all directories in the path have to be writable (for full collaboration at least) and this greatly reduces the space we have to search over. For example, running a distilled version of the loop
['/fs/ess/'].map do |root|
  Dir.each_child(root).map do |child|
    child_dir = "#{root}#{child}"
    next unless File.directory?(child_dir) && File.readable?(child_dir)
    child_dir
  end.flatten
end.flatten.compact.length

Yields 34 readable children, while changing the test to writable? only yields 3. While importing from a dir that you cannot write to may be a route to the 'read-only' collaboration, it is not something that we explicitly support and should not be including in these shortcuts (and the chance of this readability extending past the top level is very low).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions