Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fractalis
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fractalis
fractalis
Commits
571f8742
Commit
571f8742
authored
8 years ago
by
Sascha Herzinger
Browse files
Options
Downloads
Patches
Plain Diff
fixed celery config method
parent
527dca9b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fractalis/celery.py
+6
-3
6 additions, 3 deletions
fractalis/celery.py
fractalis/config.py
+9
-0
9 additions, 0 deletions
fractalis/config.py
with
15 additions
and
3 deletions
fractalis/celery.py
+
6
−
3
View file @
571f8742
...
...
@@ -4,7 +4,8 @@ import os
import
logging
from
celery
import
Celery
from
celery.exceptions
import
ImproperlyConfigured
from
fractalis.config
import
file_to_dict
def
get_scripts_packages
():
...
...
@@ -20,11 +21,13 @@ def get_scripts_packages():
packages
.
append
(
package
)
return
packages
app
=
Celery
(
__name__
)
app
.
config_from_object
(
'
fractalis.config
'
)
try
:
app
.
config_from_envvar
(
'
FRACTALIS_CONFIG
'
)
except
ImproperlyConfigured
:
config
=
file_to_dict
(
os
.
environ
[
'
FRACTALIS_CONFIG
'
])
app
.
conf
.
update
(
config
)
except
KeyError
:
logger
=
logging
.
getLogger
(
'
fractalis
'
)
logger
.
warning
(
"
FRACTALIS_CONFIG is not set. Using defaults.
"
)
app
.
autodiscover_tasks
(
packages
=
get_scripts_packages
())
This diff is collapsed.
Click to expand it.
fractalis/config.py
+
9
−
0
View file @
571f8742
...
...
@@ -9,3 +9,12 @@ BROKER_URL = 'amqp://'
CELERY_RESULT_BACKEND
=
'
redis://{}:{}
'
.
format
(
REDIS_HOST
,
REDIS_PORT
)
PERMANENT_SESSION_LIFETIME
=
timedelta
(
days
=
1
)
# DO NOT MODIFY THIS FILE!
def
file_to_dict
(
abs_path
):
config
=
{}
with
open
(
abs_path
)
as
f
:
for
line
in
f
:
(
key
,
value
)
=
[
s
.
strip
()
for
s
in
line
.
split
(
'
=
'
)]
config
[
key
]
=
value
return
config
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment