Skip to content

Commit

Permalink
Merge pull request #37 from neuro-ml/dev
Browse files Browse the repository at this point in the history
updated Redis config
  • Loading branch information
STNLd2 authored Feb 21, 2024
2 parents 6fd40bb + 6127966 commit 21f67f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bev/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.11.1'
__version__ = "0.11.2"
13 changes: 11 additions & 2 deletions bev/config/location.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
import warnings
from pathlib import Path
from typing import Optional, Sequence
from typing import Optional, Sequence, Union

import humanfriendly
import yaml
from jboc import collect
from paramiko.config import SSHConfig
from pydantic import validator
from pytimeparse.timeparse import timeparse
from tarn import S3, SCP, SFTP, DiskDict, Fanout, Level, Levels, Location, Nginx, RedisLocation, SmallLocation
from tarn.config import CONFIG_NAME as STORAGE_CONFIG_NAME, StorageConfig as TarnStorageConfig
from tarn.utils import mkdir
Expand Down Expand Up @@ -224,14 +225,22 @@ def build(self) -> Optional[Location]:
class RedisConfig(LocationConfig):
url: str
prefix: str = '_'
keep_labels: bool = False
keep_usage: bool = False
ttl: Optional[Union[int, str]] = None

@classmethod
def from_special(cls, v):
if isinstance(v, str):
return cls(url=v)

def build(self) -> Optional[Location]:
return RedisLocation(self.url, prefix=self.prefix)
if isinstance(self.ttl, str):
ttl = timeparse(self.ttl)
if ttl is None:
raise ValueError(f'The time format could not be parsed: {self.ttl}')
return RedisLocation(self.url, prefix=self.prefix, keep_labels=self.keep_labels,
keep_usage=self.keep_usage, ttl=self.ttl)


@register('small')
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ wcmatch
pyyaml
paramiko
tqdm
tarn>=0.13.2,<1.0.0
tarn>=0.14.0,<1.0.0
pydantic
pluggy
typer
typer>=0.9.0,<1.0.0
rich
jboc<1.0.0
humanfriendly
typing_extensions
pytimeparse

0 comments on commit 21f67f8

Please sign in to comment.