Exemplo n.º 1
0
    def test_automatix(self):
        """ MULTI VO (DAEMON): Test that automatix runs on a single VO """
        scope_client = ScopeClient()
        scope_uuid = str(generate_uuid()).lower()[:16]
        shr_scope = 'shr_%s' % scope_uuid
        scope_client.add_scope('root', shr_scope)
        add_scope(shr_scope, 'root', 'root', **self.new_vo)

        rse_client = RSEClient()
        rse_str = ''.join(choice(ascii_uppercase) for x in range(10))
        shr_rse = 'SHR_%s' % rse_str
        mock_protocol = {'scheme': 'MOCK',
                         'hostname': 'localhost',
                         'port': 123,
                         'prefix': '/test/automatix',
                         'impl': 'rucio.rse.protocols.mock.Default',
                         'domains': {
                             'lan': {'read': 1,
                                     'write': 1,
                                     'delete': 1},
                             'wan': {'read': 1,
                                     'write': 1,
                                     'delete': 1}}}
        rse_client.add_rse(shr_rse)
        rse_client.add_rse_attribute(rse=shr_rse, key='verify_checksum', value=False)
        rse_client.add_protocol(shr_rse, mock_protocol)
        add_rse(shr_rse, 'root', **self.new_vo)
        add_rse_attribute(rse=shr_rse, key='verify_checksum', value=False, issuer='root', **self.new_vo)
        add_protocol(rse=shr_rse, data=mock_protocol, issuer='root', **self.new_vo)

        automatix(sites=[shr_rse], inputfile='/opt/rucio/etc/automatix.json', sleep_time=30, account='root', once=True, scope=shr_scope)

        did_list_tst = list(DIDClient().list_dids(shr_scope, {}))
        did_list_new = list(list_dids(shr_scope, {}, **self.new_vo))
        assert_not_equal(len(did_list_tst), 0)
        assert_equal(len(did_list_new), 0)

        did_dicts = [{'scope': shr_scope, 'name': n} for n in did_list_tst]
        replicas_tst = list(ReplicaClient().list_replicas(did_dicts, rse_expression=shr_rse))
        replicas_new = list(list_replicas(did_dicts, rse_expression=shr_rse, **self.new_vo))
        assert_not_equal(len(replicas_tst), 0)
        assert_equal(len(replicas_new), 0)
Exemplo n.º 2
0
    'domains': {
        "lan": {
            "read": 1,
            "write": 1,
            "delete": 1
        },
        "wan": {
            "read": 1,
            "write": 1,
            "delete": 1
        }
    }
}

try:
    p = rseclient.add_protocol(rse_name, params)  # p is true on success
    print('Added protocol to Theta %s' % p)
except Duplicate:
    print('Protocol existed on Theta')

#result = rseclient.add_rse_attribute(rse = rse_name, key = 'naming_convention', value = 'surl') # This is the value for relative SURL
result = rseclient.add_rse_attribute(
    rse=rse_name,
    key='globus_endpoint_id',
    value='08925f04-569f-11e7-bef8-22000b9a448b')
result = rseclient.add_rse_attribute(rse=rse_name,
                                     key='lfn2pfn_algorithm',
                                     value='cmstfc')
#result = rseclient.add_rse_attribute(rse = rse_name, key = 'istape', value = False)

rse_name = 'T3_US_NERSC'