Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sciunit vcs checkin more robust #35

Merged
merged 3 commits into from
Jan 31, 2024
Merged
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
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