Ejemplo n.º 1
0
 def test_hmac_config_file(self):
     _file = "config_hmac.ini"
     config = config_from_file(os.path.join(TEST_ROOT, _file))
     auth = auth_from_config(config)
     self.assertEqual(type(auth), HMACAuth)
     client = client_from_config_file(os.path.join(TEST_ROOT, _file))
     self.assertEqual(type(client.http_client.auth_strategy), HMACAuth)
Ejemplo n.º 2
0
 def test_hmac_config_file(self):
     _file = "config_hmac.ini"
     config = config_from_file(os.path.join(TEST_ROOT, _file))
     auth = auth_from_config(config)
     self.assertEqual(type(auth), HMACAuth)
     client = client_from_config_file(os.path.join(TEST_ROOT, _file))
     self.assertEqual(type(client.http_client.auth_strategy), HMACAuth)
Ejemplo n.º 3
0
    def test_no_config_with_mode(self):
        config = config_from_file(os.path.join(TEST_ROOT, "config_blank.ini"), mode="prod")
        auth = auth_from_config(config)
        self.assertEqual(config["url"], default_url(mode="prod"))
        self.assertEqual(auth, None)

        client = client_from_config_file(path=os.path.join(TEST_ROOT, "config_blank.ini"))
        self.assertEqual(client.http_client.auth_strategy, None)
Ejemplo n.º 4
0
    def __init__(self):

        config_file = os.path.dirname(__file__) + '/../tests/config_srs.ini'
        self.client = client_from_config_file(
            config_file
        )  # Reads default config files or returns a default config
        self.sched = sched.scheduler(time.time, time.sleep)
        self._run()
Ejemplo n.º 5
0
    def test_no_config_with_mode(self):
        config = config_from_file(os.path.join(TEST_ROOT, "config_blank.ini"),
                                  mode="prod")
        auth = auth_from_config(config)
        self.assertEqual(config["url"], default_url(mode="prod"))
        self.assertEqual(auth, None)

        client = client_from_config_file(
            path=os.path.join(TEST_ROOT, "config_blank.ini"))
        self.assertEqual(client.http_client.auth_strategy, None)
Ejemplo n.º 6
0
    def init(self):
        """initialize the RESTful interface to the dataCatalog"""
        if self.client != None: return
        print 'Initializing RESTful dataCatalog interface'

        import datacat
        config_path = os.path.join(os.getenv('DATACAT_CONFIG','/nfs/farm/g/lsst/u1/software/datacat'),'config.cfg')
        self.dcVersion = datacat.__version__
        self.client = datacat.client_from_config_file(config_path)

        return
Ejemplo n.º 7
0
    def init(self):
        """initialize the RESTful interface to the dataCatalog"""
        if self.client != None: return
        print 'Initializing RESTful dataCatalog interface'

        import datacat
        config_path = os.path.join(
            os.getenv('DATACAT_CONFIG',
                      '/nfs/farm/g/lsst/u1/software/datacat'), 'config.cfg')
        self.dcVersion = datacat.__version__
        self.client = datacat.client_from_config_file(config_path)

        return
Ejemplo n.º 8
0
    def init(self):
        """initialize the RESTful interface to the dataCatalog"""
        if self.client != None: return
        print 'Initializing RESTful dataCatalog interface'
        dc1 = '/afs/slac.stanford.edu/u/gl/srs/datacat/'+self.dcVer+'/lib'
        sys.path.append(dc1)
 
        import datacat
        config_path = os.path.join(os.getenv('DATACAT_CONFIG','/nfs/farm/g/lsst/u1/software/datacat'),'config.cfg')
        self.dcVersion = datacat.__version__
        self.client = datacat.client_from_config_file(config_path)

        return
Ejemplo n.º 9
0
 def __init__(self):
     self.client = client_from_config_file()  # Reads default config files or returns a default config
     self.sched = sched.scheduler(time.time, time.sleep)
     self._run()
Ejemplo n.º 10
0
"""

import os
import subprocess
import datacat
import datacat.error
from datacat import client_from_config_file
from datacat.model import Folder
import argparse

remote_hosts = {
    'SLAC': 'rhel6-64.slac.stanford.edu',
    'slac.lca.archive': 'rhel6-64.slac.stanford.edu'
}

client = client_from_config_file()


def is_valid_folder(child):
    try:
        if isinstance(child, Folder) and float(child.name):
            return True
    except ValueError:
        pass
    return False


def _get_job_id(dataset):
    folder = os.path.split(dataset.path)[0]
    return str(os.path.split(folder)[1])
Ejemplo n.º 11
0
 def __init__(self):
     self.client = client_from_config_file(
     )  # Reads default config files or returns a default config
     self.sched = sched.scheduler(time.time, time.sleep)
     self._run()