Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
beat
beat.web
Commits
f668d9d4
Commit
f668d9d4
authored
9 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[backend] Allow settings to be defined for worker subprocesses
parent
dfbc4f22
No related branches found
No related tags found
1 merge request
!194
Scheduler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beat/web/backend/schedule.py
+5
-2
5 additions, 2 deletions
beat/web/backend/schedule.py
beat/web/scripts/worker.py
+1
-1
1 addition, 1 deletion
beat/web/scripts/worker.py
with
6 additions
and
3 deletions
beat/web/backend/schedule.py
+
5
−
2
View file @
f668d9d4
...
@@ -405,7 +405,7 @@ def worker_update():
...
@@ -405,7 +405,7 @@ def worker_update():
@transaction.atomic
@transaction.atomic
def
work
(
environments
,
cpulimit
,
process
):
def
work
(
environments
,
cpulimit
,
process
,
settings
):
'''
Launches user code on isolated processes
'''
Launches user code on isolated processes
This function is supposed to be called asynchronously, by a scheduling
This function is supposed to be called asynchronously, by a scheduling
...
@@ -429,6 +429,9 @@ def work(environments, cpulimit, process):
...
@@ -429,6 +429,9 @@ def work(environments, cpulimit, process):
process (str): The path to the ``process.py`` program to use for running
process (str): The path to the ``process.py`` program to use for running
the user code on isolated processes.
the user code on isolated processes.
settings (str): The name of the module containing the Django settings for
use with the process program
'''
'''
# myself, raises if I cannot find me
# myself, raises if I cannot find me
...
@@ -441,7 +444,7 @@ def work(environments, cpulimit, process):
...
@@ -441,7 +444,7 @@ def work(environments, cpulimit, process):
j
.
end
(
None
,
Job
.
CANCELLED
)
j
.
end
(
None
,
Job
.
CANCELLED
)
# cmdline base argument
# cmdline base argument
cmdline
=
[
process
]
cmdline
=
[
process
,
'
--settings=%s
'
%
settings
]
if
cpulimit
is
not
None
:
cmdline
+=
[
'
--cpulimit=%s
'
%
cpulimit
]
if
cpulimit
is
not
None
:
cmdline
+=
[
'
--cpulimit=%s
'
%
cpulimit
]
if
settings
.
DEBUG
:
cmdline
+=
[
'
-vv
'
]
if
settings
.
DEBUG
:
cmdline
+=
[
'
-vv
'
]
...
...
This diff is collapsed.
Click to expand it.
beat/web/scripts/worker.py
+
1
−
1
View file @
f668d9d4
...
@@ -124,7 +124,7 @@ def main(user_input=None):
...
@@ -124,7 +124,7 @@ def main(user_input=None):
while
not
stop
:
while
not
stop
:
start
=
time
.
time
()
start
=
time
.
time
()
work
(
environments
,
cpulimit
,
process
)
work
(
environments
,
cpulimit
,
process
,
arguments
[
'
--settings
'
]
)
currtime
=
time
.
time
()
currtime
=
time
.
time
()
duration
=
currtime
-
start
duration
=
currtime
-
start
...
...
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