예제 #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)
예제 #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)
예제 #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)
예제 #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()
예제 #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)
예제 #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
예제 #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
예제 #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
예제 #9
0
파일: crawler.py 프로젝트: slaclab/datacat
 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()
예제 #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])
예제 #11
0
파일: crawler.py 프로젝트: brianv0/datacat
 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()