Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
92ca2c77
Commit
92ca2c77
authored
Mar 29, 2019
by
Markus Scheidgen
Browse files
Isolate config from utils to allow to use config for log init.
parent
09dea5a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
nomad/config.py
View file @
92ca2c77
...
...
@@ -19,24 +19,32 @@ import yaml
import
warnings
from
kombu
import
Queue
from
nomad
import
utils
warnings
.
filterwarnings
(
"ignore"
,
message
=
"numpy.dtype size changed"
)
warnings
.
filterwarnings
(
"ignore"
,
message
=
"numpy.ufunc size changed"
)
class
NomadConfig
(
utils
.
POPO
):
pass
class
NomadConfig
(
dict
):
"""
A dict subclass that uses attributes as key/value pairs.
"""
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
def
__getattr__
(
self
,
name
):
if
name
in
self
:
return
self
[
name
]
else
:
raise
AttributeError
(
"No such attribute: "
+
name
)
def
__setattr__
(
self
,
name
,
value
):
self
[
name
]
=
value
def
__delattr__
(
self
,
name
):
if
name
in
self
:
del
self
[
name
]
else
:
raise
AttributeError
(
"No such attribute: "
+
name
)
# class ConfigProperty:
# def __init__(
# self, name: str, default_value: Union[int, str, bool], help: str = None,
# env_var: str = None) -> None:
# self.name = name
# self.default_value = default_value,
# self.help = help
# self.env_var = env_var
CELERY_WORKER_ROUTING
=
'worker'
CELERY_QUEUE_ROUTING
=
'queue'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment