Skip to content

Commit

Permalink
Merge pull request #35 from charmoniumQ/patch-1
Browse files Browse the repository at this point in the history
Make sciunit vcs checkin more robust
  • Loading branch information
sranasir committed Jan 31, 2024
2 parents 6f4d094 + 35cef52 commit a4f2018
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sciunit2/version_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def __init__(self, location):
# adds a new execution to the de-duplication engine
def checkin(self, rev, pkgdir, spinner):
parent, name = os.path.split(os.path.abspath(pkgdir))
# Let filesystem settle before trying to tar it up
# This avoids "file changed as we read it"
os.sync()
# creates a tar file from dir 'name' in 'parent' dir,
# writes it to stdout, then commits it to
# de-duplication engine using 'vv' under the 'rev' eid
Expand All @@ -40,7 +43,8 @@ def checkin(self, rev, pkgdir, spinner):
_, err = p.communicate()
if p.returncode == 0:
self.cleanup(pkgdir)
return int(err)
last_line = err.strip().split(b"\n")[-1]
return int(last_line)
else:
raise CommandError('execution %r already exists' % rev
if self.__found(rev) else err)
Expand Down

0 comments on commit a4f2018

Please sign in to comment.