コード例 #1
0
    def __init__(self,
                 base,
                 bases=None,
                 gfal_options=None,
                 transfer_config=None,
                 atomic_contexts=False,
                 retries=0,
                 retry_delay=0,
                 permissions=True,
                 validate_copy=False,
                 cache_config=None):
        FileSystem.__init__(self)

        # configure the gfal interface
        self.gfal = GFALInterface(base,
                                  bases,
                                  gfal_options=gfal_options,
                                  transfer_config=transfer_config,
                                  atomic_contexts=atomic_contexts,
                                  retries=retries,
                                  retry_delay=retry_delay)

        # store other configs
        self.permissions = permissions
        self.validate_copy = validate_copy

        # set the cache when a cache root is set
        if cache_config and cache_config.get("root"):
            self.cache = RemoteCache(self, **cache_config)
        else:
            self.cache = None
コード例 #2
0
    def __init__(self, section=None, **kwargs):
        # if present, read options from the section in the law config
        self.config_section = None
        cfg = Config.instance()
        if not section:
            section = cfg.get_expanded("target", "default_local_fs")
        if isinstance(section, six.string_types):
            if cfg.has_section(section):
                # extend options of sections other than "local_fs" with its defaults
                if section != "local_fs":
                    data = dict(cfg.items("local_fs", expand_vars=False, expand_user=False))
                    cfg.update({section: data}, overwrite_sections=True, overwrite_options=False)
                kwargs = self.parse_config(section, kwargs)
                self.config_section = section
            else:
                raise Exception("law config has no section '{}' to read {} options".format(
                    section, self.__class__.__name__))

        FileSystem.__init__(self, **kwargs)
コード例 #3
0
ファイル: remote.py プロジェクト: Nollde/law
    def __init__(self,
                 base,
                 bases=None,
                 gfal_options=None,
                 transfer_config=None,
                 atomic_contexts=False,
                 retries=0,
                 retry_delay=0,
                 random_base=True,
                 validate_copy=False,
                 recursive_remove=False,
                 use_cache=False,
                 cache_config=None,
                 local_fs=None,
                 **kwargs):
        FileSystem.__init__(self, **kwargs)

        # configure the gfal interface
        self.gfal = GFALInterface(base,
                                  bases,
                                  gfal_options=gfal_options,
                                  transfer_config=transfer_config,
                                  atomic_contexts=atomic_contexts,
                                  retries=retries,
                                  retry_delay=retry_delay,
                                  random_base=random_base)

        # store other configs
        self.validate_copy = validate_copy
        self.recursive_remove = recursive_remove
        self.use_cache = use_cache

        # set the cache when a cache root is set
        if cache_config and cache_config.get("root"):
            self.cache = RemoteCache(self, **cache_config)
        else:
            self.cache = None

        if local_fs:
            self.local_fs = local_fs