[ARVADOS] updated: 0b0f8c5211ee93d2fd2bceb2a4331a06cea52663
git at public.curoverse.com
git at public.curoverse.com
Mon Feb 17 13:26:54 EST 2014
Summary of changes:
sdk/cli/bin/arv | 4 ++--
sdk/python/arvados/keep.py | 2 +-
sdk/python/bin/arv-ls | 28 ++++++++++++++++++++++++++++
sdk/python/bin/arv-put | 16 ++++++++++++++++
4 files changed, 47 insertions(+), 3 deletions(-)
create mode 100755 sdk/python/bin/arv-ls
via 0b0f8c5211ee93d2fd2bceb2a4331a06cea52663 (commit)
from 600378f933f028ba497cac86a978fa71401d209b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 0b0f8c5211ee93d2fd2bceb2a4331a06cea52663
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Feb 17 13:22:48 2014 -0500
Working on arv-ls
diff --git a/sdk/cli/bin/arv b/sdk/cli/bin/arv
index b922e5b..957a6f3 100755
--- a/sdk/cli/bin/arv
+++ b/sdk/cli/bin/arv
@@ -36,10 +36,10 @@ case ARGV[0]
when 'keep'
ARGV.shift
@sub = ARGV.shift
- if ['get', 'put'].index @sub then
+ if ['get', 'put', 'ls'].index @sub then
# Native Arvados
exec `which arv-#{@sub}`.strip, *ARGV
- elsif ['ls', 'less', 'check'].index @sub then
+ elsif ['less', 'check'].index @sub then
# wh* shims
exec `which wh#{@sub}`.strip, *ARGV
else
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 7d2b72a..38dddbe 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -274,7 +274,7 @@ class KeepClient(object):
self._cache.insert(0, n)
return n[1]
finally:
- self.cache_lock.release()
+ self._cache_lock.release()
return None
@staticmethod
diff --git a/sdk/python/bin/arv-ls b/sdk/python/bin/arv-ls
new file mode 100755
index 0000000..f30145a
--- /dev/null
+++ b/sdk/python/bin/arv-ls
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import argparse
+import hashlib
+import os
+import re
+import string
+import sys
+import logging
+
+logger = logging.getLogger(os.path.basename(sys.argv[0]))
+
+parser = argparse.ArgumentParser(
+ description='List contents of a manifest')
+
+parser.add_argument('locator', type=str,
+ help="""
+Collection locator, optionally with a file path or prefix.
+""")
+
+args = parser.parse_args()
+
+import arvados
+
+cr = arvados.CollectionReader(arvados.Keep.get(args.locator))
+
+for f in rc.all_files():
+ print(f.stream_name() + "/" + f.name())
diff --git a/sdk/python/bin/arv-put b/sdk/python/bin/arv-put
index a47de30..08b3f3d 100755
--- a/sdk/python/bin/arv-put
+++ b/sdk/python/bin/arv-put
@@ -9,10 +9,12 @@ import sys
parser = argparse.ArgumentParser(
description='Copy data from the local filesystem to Keep.')
+
parser.add_argument('paths', metavar='path', type=str, nargs='*',
help="""
Local file or directory. Default: read from standard input.
""")
+
parser.add_argument('--max-manifest-depth', type=int, metavar='N', default=-1,
help="""
Maximum depth of directory tree to represent in the manifest
@@ -21,45 +23,55 @@ as a single stream in the manifest. If N=0, the manifest will contain
a single stream. Default: -1 (unlimited), i.e., exactly one manifest
stream per filesystem directory that contains files.
""")
+
group = parser.add_mutually_exclusive_group()
+
group.add_argument('--as-stream', action='store_true', dest='stream',
help="""
Synonym for --stream.
""")
+
group.add_argument('--stream', action='store_true',
help="""
Store the file content and display the resulting manifest on
stdout. Do not write the manifest to Keep or save a Collection object
in Arvados.
""")
+
group.add_argument('--as-manifest', action='store_true', dest='manifest',
help="""
Synonym for --manifest.
""")
+
group.add_argument('--in-manifest', action='store_true', dest='manifest',
help="""
Synonym for --manifest.
""")
+
group.add_argument('--manifest', action='store_true',
help="""
Store the file data and resulting manifest in Keep, save a Collection
object in Arvados, and display the manifest locator (Collection uuid)
on stdout. This is the default behavior.
""")
+
group.add_argument('--as-raw', action='store_true', dest='raw',
help="""
Synonym for --raw.
""")
+
group.add_argument('--raw', action='store_true',
help="""
Store the file content and display the data block locators on stdout,
separated by commas, with a trailing newline. Do not store a
manifest.
""")
+
parser.add_argument('--use-filename', type=str, default=None, dest='filename',
help="""
Synonym for --filename.
""")
+
parser.add_argument('--filename', type=str, default=None,
help="""
Use the given filename in the manifest, instead of the name of the
@@ -67,6 +79,7 @@ local file. This is useful when "-" or "/dev/stdin" is given as an
input file. It can be used only if there is exactly one path given and
it is not a directory. Implies --manifest.
""")
+
group = parser.add_mutually_exclusive_group()
group.add_argument('--progress', action='store_true',
help="""
@@ -74,11 +87,13 @@ Display human-readable progress on stderr (bytes and, if possible,
percentage of total data size). This is the default behavior when
stderr is a tty.
""")
+
group.add_argument('--no-progress', action='store_true',
help="""
Do not display human-readable progress on stderr, even if stderr is a
tty.
""")
+
group.add_argument('--batch-progress', action='store_true',
help="""
Display machine-readable progress on stderr (bytes and, if known,
@@ -129,6 +144,7 @@ class CollectionWriterWithProgress(arvados.CollectionWriter):
self.bytes_expected >> 20, pct))
else:
sys.stderr.write('\r%d ' % self.bytes_flushed)
+
def manifest_text(self, *args, **kwargs):
manifest_text = (super(CollectionWriterWithProgress, self)
.manifest_text(*args, **kwargs))
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list