Ejemplo n.º 1
0
    def get(self, pfn, dest, transfer_timeout=None):
        """ Provides access to files stored inside connected the RSE.

            :param pfn Physical file name of requested file
            :param dest Name and path of the files when stored at the client
            :param transfer_timeout Transfer timeout (in seconds)

            :raises DestinationNotAccessible, ServiceUnavailable, SourceNotFound
         """

        # storm prefix needs to be replaced by davs in order to get etag
        pfn = 'davs' + pfn[5:]

        # retrieve the TURL from the webdav etag, TODO: make it configurable
        cmd = 'davix-http --capath /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/etc/grid-security-emi/certificates --cert $X509_USER_PROXY -X PROPFIND %s' % pfn
        try:
            rcode, output = run_cmd_process(cmd, timeout=10)
        except Exception as e:
            raise exception.ServiceUnavailable('Could not retrieve STORM WebDAV ETag: %s' % str(e))
        p_output = minidom.parseString(output)

        # we need to strip off the quotation marks and the <timestamp> from the etag
        # but since we can have multiple underscores, we have to rely on the uniqueness
        # of the full LFN to make the split
        target = p_output.getElementsByTagName('d:getetag')[0].childNodes[0].nodeValue.replace('"', '')
        target_ending = '_' + target.split('_')[-1]
        target = target.split(target_ending)[0]

        # make the symlink
        try:
            os.symlink(target, dest)
        except Exception as e:
            exception.ServiceUnavailable('Could not create symlink: %s for target %s' % (str(e), str(target)))
Ejemplo n.º 2
0
def poll_fts_transfer_status(request_id, timeout=30):
    rcode, out = run_cmd_process(
        f"/usr/bin/python2 /usr/bin/fts-rest-transfer-status -v -s https://fts:8446 {request_id}",
        timeout=timeout)
    transfer_status = None
    if rcode == 0:
        transfer_status = re.search("Status: (.*)", out).group(1)
    return transfer_status
Ejemplo n.º 3
0
 def davix_etag(pfn, timeout):
     pfn = 'davs' + pfn[5:]
     cmd = 'davix-http --capath /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/etc/grid-security-emi/certificates --cert $X509_USER_PROXY -X PROPFIND %s' % pfn
     try:
         rcode, output = run_cmd_process(cmd, timeout=timeout)
         if rcode != 0:
             if output:
                 raise exception.ServiceUnavailable("{}/n{}".format(str(output), cmd))
             else:
                 raise exception.ServiceUnavailable('Error message from subprocess davix-http call is missing./n{}'.format(cmd))
     except Exception as e:
         raise exception.ServiceUnavailable('Could not retrieve STORM WebDAV ETag: {}/n{}'.format(str(e), cmd))
     return rcode, output
Ejemplo n.º 4
0
def list_fts_transfer(timeout=60, min_attempts=20):
    running_time = 0
    request_id = None
    request_status = None
    attempt = 1

    time_start = time.time()
    while running_time < timeout and attempt <= min_attempts:
        rcode, out = run_cmd_process("/usr/bin/python2 /usr/bin/fts-rest-transfer-list -v -s https://fts:8446")
        if "Request ID" in out:
            request_id = re.search("Request ID: (.*)", out).group(1)
            request_status = re.search("Status: (.*)", out).group(1)
            break
        attempt = attempt + 1
        time_now = time.time()
        running_time = int(time_now - time_start)

    return request_id, request_status
Ejemplo n.º 5
0
    def get(self, pfn, dest, transfer_timeout=None):
        """ Provides access to files stored inside connected the RSE.

            :param pfn Physical file name of requested file
            :param dest Name and path of the files when stored at the client
            :param transfer_timeout Transfer timeout (in seconds)

            :raises DestinationNotAccessible, ServiceUnavailable, SourceNotFound
         """

        # storm prefix needs to be replaced by davs in order to get etag
        pfn = 'davs' + pfn[5:]

        # retrieve the TURL from the webdav etag, TODO: make it configurable
        cmd = 'davix-http --capath /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/etc/grid-security-emi/certificates --cert $X509_USER_PROXY -X PROPFIND %s' % pfn
        try:
            rcode, output = run_cmd_process(cmd, timeout=10)
        except Exception, e:
            raise exception.ServiceUnavailable(
                'Could not retrieve STORM WebDAV ETag: %s' % str(e))