Skip to content

Commit

Permalink
soft_link works on cloud platforms now
Browse files Browse the repository at this point in the history
  • Loading branch information
leepc12 committed Jul 4, 2019
1 parent 90da36d commit 1f41dd9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion caper/caper_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from distutils.util import strtobool


__version__ = '0.3.10'
__version__ = '0.3.11'

DEFAULT_JAVA_HEAP_SERVER = '5G'
DEFAULT_JAVA_HEAP_RUN = '1G'
Expand Down
18 changes: 10 additions & 8 deletions caper/caper_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,13 @@ def copy(self, target_uri_type=None, target_uri=None, soft_link=False,
uri_type=URI_LOCAL, no_copy=no_copy)
return CaperURI(tmp_local_f).copy(target_uri=path,
no_copy=no_copy)
if soft_link:
if uri_type == URI_GCS and self._uri_type == URI_GCS:
return self._uri
elif uri_type == URI_S3 and self._uri_type == URI_S3:
return self._uri

if CaperURI.VERBOSE:
if CaperURI.VERBOSE and uri_type not in (URI_URL,):
if soft_link and self._uri_type == URI_LOCAL \
and uri_type == URI_LOCAL:
method = 'symlinking'
Expand All @@ -279,8 +284,8 @@ def copy(self, target_uri_type=None, target_uri=None, soft_link=False,

# if target file not exists or file sizes are different
# then do copy!
if not cu_target.file_exists() or \
self.get_file_size() != cu_target.get_file_size():
if uri_type not in (URI_URL,) and (not cu_target.file_exists() or \
self.get_file_size() != cu_target.get_file_size()):

action = 'done'
cu_lock = CaperURI(path + CaperURI.LOCK_EXT)
Expand All @@ -289,10 +294,7 @@ def copy(self, target_uri_type=None, target_uri=None, soft_link=False,
cu_lock.write_str_to_file('', quiet=True)

# do copy
if uri_type == URI_URL:
pass

elif uri_type == URI_GCS:
if uri_type == URI_GCS:
if self._uri_type == URI_URL:
assert(False)

Expand Down Expand Up @@ -371,7 +373,7 @@ def copy(self, target_uri_type=None, target_uri=None, soft_link=False,
# remove .lock file
cu_lock.rm(quiet=True)

if CaperURI.VERBOSE:
if CaperURI.VERBOSE and uri_type not in (URI_URL,)::
print('[CaperURI] {method} {action}, target: {target}'.format(
method=method, action=action, target=path))
return path
Expand Down

0 comments on commit 1f41dd9

Please sign in to comment.