[ET Trac] [Einstein Toolkit] #174: Remove cd semaphore from GetComponents

Einstein Toolkit trac-noreply at einsteintoolkit.org
Sun Dec 26 20:24:47 CST 2010

#174: Remove cd semaphore from GetComponents
 Reporter:  eschnett       |       Owner:  eric9
     Type:  defect         |      Status:  new  
 Priority:  major          |   Milestone:       
Component:  GetComponents  |     Version:       
 Keywords:                 |  
 GetComponents uses a semaphore that decides which task can cd into a
 subdirectory. This limits parallelism, since in essence only one task can
 cd into (and presumably thus access) a repository. Furthermore, using
 semaphores is a tedious and complex way to handle parallelism.

 I suggest to remove the semaphore, and instead not use cd within
 GetComponents at all. Instead, run_command should take care of this. For
 example, instead of

                 if ($PARALLEL) {$cd_sem->down()}
                 my $err = run_command("git checkout --track -b $branch
                 if ($PARALLEL) {$cd_sem->up()}

 I would write

                 my $err = run_command("cd $orig_dir/$ROOT/repos/$git_repo
 && git checkout --track -b $branch origin/$branch");

 which is four lines shorter, doesn't use semaphores, and doesn't have to
 handle semaphores and "cd'ing back" in error clean-up code.

 I've omitted the error clean-up code in the above; indeed in the example
 i'm looking at, this cleanup code neither releases the semaphore nor cds
 back into the original directory.

 Using cd this way may also avoid all problems where thorns are
 accidentally checked out into the wrong directory.

Ticket URL: <https://trac.einsteintoolkit.org/ticket/174>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit

More information about the Trac mailing list