Skip to content
Draft
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions sciunit2/command/checkout.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import

from sciunit2.command import AbstractCommand
from sciunit2.command.context import CheckoutContext
from sciunit2.command.context import CheckoutContext_Parallel
from sciunit2.exceptions import CommandLineError
from sciunit2.util import quoted_format
import sciunit2.core
Expand All @@ -22,7 +22,7 @@ def run(self, args):
optlist, args = getopt(args, '')
if len(args) != 1:
raise CommandLineError
with CheckoutContext(args[0]) as (pkgdir, _):
with CheckoutContext_Parallel(args[0]) as (pkgdir, _):
return pkgdir

def note(self, project_dir):
Expand Down
12 changes: 12 additions & 0 deletions sciunit2/command/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def CheckoutContext(rev):
repo.checkout(rev)
yield pkgdir, orig

# returns the pkgdir and original command used
# to execute execution 'rev'
@contextmanager
def CheckoutContext_Parallel(rev):
emgr, repo = sciunit2.workspace.current()
with emgr.exclusive():
orig = emgr.get(rev).cmd
pkgdir = os.path.join(repo.location,rev,'cde-package')
repo.cleanup(pkgdir)
repo.checkout_Parallel(rev)
yield pkgdir, orig


@contextmanager
def CheckoutContext_Diff(rev):
Expand Down
4 changes: 2 additions & 2 deletions sciunit2/command/repeat.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import

from sciunit2.command import AbstractCommand
from sciunit2.command.context import CheckoutContext
from sciunit2.command.context import CheckoutContext_Parallel
from sciunit2.exceptions import CommandLineError
import sciunit2.core

Expand All @@ -21,5 +21,5 @@ def run(self, args):
optlist, args = getopt(args, '')
if not args:
raise CommandLineError
with CheckoutContext(args[0]) as (pkgdir, orig):
with CheckoutContext_Parallel(args[0]) as (pkgdir, orig):
sys.exit(sciunit2.core.repeat(pkgdir, orig, args[1:]))
15 changes: 15 additions & 0 deletions sciunit2/version_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ def checkout(self, rev):
raise CommandError('execution %r not found' % rev
if not self.__found(rev) else err)

# brings out the execution identified by 'rev'
# from the de-duplication engine
def checkout_Parallel(self, rev):
rev_repo = os.path.join(self.location, rev)
self._mkdir_p(rev_repo)
self.cleanup(os.path.join(rev_repo, 'cde-package'))
cmd = quoted_format('{0} checkout {1} - | tar xf - -C {2}',
sciunit2.libexec.vv.which, rev, rev_repo)
p = subprocess.Popen(cmd, shell=True, cwd=self.location, stderr=PIPE)
_, err = p.communicate()
print("hi in checkout parallel"+cmd)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please remove the debug messages

if p.wait() != 0:
raise CommandError('execution %r not found' % rev
if not self.__found(rev) else err)

def checkout_Diff(self, rev):
cmd = quoted_format('{0} checkout {1} - | tar xf -',
sciunit2.libexec.vv.which, rev)
Expand Down