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

bug fix for rsync on remote compressed file #53

Merged
merged 2 commits into from
Jan 5, 2024
Merged
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: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Change Log

This document records the main changes to the sdss_access code.

3.0.4 (unreleased)
------------------
- Fix issue `52` - rsync failure when remote file is compressed compared to template

3.0.3 (11-29-2023)
------------------
- Add new ``tilegrp`` method for grouping LVM tile ids
Expand Down
6 changes: 3 additions & 3 deletions python/sdss_access/sync/rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class RsyncAccess(BaseAccess):
remote_scheme = 'rsync'
access_mode = 'rsync'

def __init__(self, label='sdss_rsync', stream_count=5, mirror=False, public=False, release=None,
def __init__(self, label='sdss_rsync', stream_count=5, mirror=False, public=False, release=None,
verbose=False):
super(RsyncAccess, self).__init__(stream_count=stream_count, mirror=mirror, public=public,
super(RsyncAccess, self).__init__(stream_count=stream_count, mirror=mirror, public=public,
release=release, verbose=verbose)
self.label = label
self.auth = None
Expand All @@ -29,7 +29,7 @@ def __repr__(self):

def get_task_out(self, task=None):
if task:
command = "rsync -R %(source)s" % task
command = "rsync -R %(source)s*" % task
if self.verbose:
print(command)
status, out, err = self.stream.cli.foreground_run(command)
Expand Down
16 changes: 16 additions & 0 deletions tests/sync/test_rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ def test_release_from_module(self, monkeypatch, tree_ver, exp):
assert rsync.release == tree_ver
assert exp in loc

def test_remote_compression(self):
""" test we can find the correct file when the remote file is compressed """
rsync = RsyncAccess(release='ipl3')
rsync.remote()

# template path is not compressed
ff = rsync.templates["mwmAllStar"]
assert ff.endswith('summary/mwmAllStar-{v_astra}.fits')

# remote source is fully resolved path
rsync.add("mwmAllStar", v_astra="0.5.0")
rsync.set_stream()
source = rsync.stream.task[0]['source']
assert source.endswith('0.5.0/summary/mwmAllStar-0.5.0.fits.gz')



class TestRsyncFails(object):

Expand Down
Loading