Skip to content

Commit

Permalink
Merge pull request #53 from sdss/remotecomp
Browse files Browse the repository at this point in the history
bug fix for rsync on remote compressed file
  • Loading branch information
havok2063 authored Jan 5, 2024
2 parents 577fc3e + 5f02a45 commit 1e6f63e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
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

0 comments on commit 1e6f63e

Please sign in to comment.