コード例 #1
0
ファイル: test_non_attached.py プロジェクト: ChengHsi/rucyio
from rucio.client.didclient import DIDClient
dc = DIDClient()
import sys
# # remove client rucio path and use /opt/rucio/lib as server path
# sys.path.insert(0, '/opt/rucio/lib/')
# sys.path.remove('/opt/rucio/.venv/lib/python2.6/site-packages/rucio-0.2.5_15_g2289bda_dev1416935547-py2.6.egg')
# del sys.modules['rucio']
# # import imp
# # rucio = imp.load_source('rucio','/opt/rucio/lib/rucio/__init__.py')
# from rucio.api.did import get_did


# print get_did('ams-user-chenghsi', 'd2')
# dc.detach_dids('ams-user-chenghsi', 'd1', ['file3'])
# dc.non_attached('ams-user-chenghsi', [{'scope':'ams-user-chenghsi', 'name':'file1'}, {'scope':'ams-user-chenghsi', 'name':'file2'}])
print dc.non_attached('twgrid-user-chenghsi', [{'scope':'ams-user-chenghsi', 'name':'file1'}, {'scope':'twgrid-user-chenghsi', 'name':'file2'}, {'scope':'twgrid-user-chenghsi', 'name':'file6'}, {'scope':'twgrid-user-chenghsi', 'name':'file1'}])
# print dc.non_attached('ams-user-chenghsi', ['file1', 'name':'file2'}])
# @stream_session
@read_session
def non_attached(scope, names, session=None):
    """
    List data identifier contents.

    :param scope: The scope name.
    :param names: The data identifier name.
    :param session: The database session in use.
    """
    attached_dids = []
    detached_dids = []
    file = DIDType.from_sym('FILE')
    try: