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
25d10f5e
Commit
25d10f5e
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[localhost] Update worker hostname
parent
f393d1fc
No related branches found
No related tags found
1 merge request
!194
Scheduler
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/scripts/localhost.py
+11
-10
11 additions, 10 deletions
beat/web/scripts/localhost.py
with
11 additions
and
10 deletions
beat/web/scripts/localhost.py
+
11
−
10
View file @
25d10f5e
...
@@ -196,17 +196,11 @@ SCHEDULER_BIN = os.path.join(bindir, 'scheduler.py')
...
@@ -196,17 +196,11 @@ SCHEDULER_BIN = os.path.join(bindir, 'scheduler.py')
WORKER_BIN
=
os
.
path
.
join
(
bindir
,
'
worker.py
'
)
WORKER_BIN
=
os
.
path
.
join
(
bindir
,
'
worker.py
'
)
def
get_scheduler_token
(
django_settings
):
def
get_scheduler_token
(
account
):
"""
Retrieves the scheduler token from the Django database
"""
"""
Retrieves the scheduler token from the Django database
"""
os
.
environ
.
setdefault
(
'
DJANGO_SETTINGS_MODULE
'
,
django_settings
)
from
django.conf
import
settings
from
django
import
setup
setup
()
from
rest_framework.authtoken.models
import
Token
from
rest_framework.authtoken.models
import
Token
return
Token
.
objects
.
get
(
user__username
=
settings
.
SCHEDULER_ACCOUNT
).
key
return
Token
.
objects
.
get
(
user__username
=
account
).
key
def
main
(
user_input
=
None
):
def
main
(
user_input
=
None
):
...
@@ -227,6 +221,12 @@ def main(user_input=None):
...
@@ -227,6 +221,12 @@ def main(user_input=None):
try
:
try
:
os
.
environ
.
setdefault
(
'
DJANGO_SETTINGS_MODULE
'
,
arguments
[
'
--settings
'
])
from
django.conf
import
settings
from
django
import
setup
setup
()
# Web server, via django
# Web server, via django
web_arguments
=
[
web_arguments
=
[
DJANGO_BIN
,
DJANGO_BIN
,
...
@@ -247,7 +247,7 @@ def main(user_input=None):
...
@@ -247,7 +247,7 @@ def main(user_input=None):
'
--port=10001
'
,
#worker -> scheduler port
'
--port=10001
'
,
#worker -> scheduler port
'
--sport=10000
'
,
#web -> scheduler port
'
--sport=10000
'
,
#web -> scheduler port
'
--web-api=http://127.0.0.1:8000/api/v1
'
,
#web API URL
'
--web-api=http://127.0.0.1:8000/api/v1
'
,
#web API URL
'
--secret-key=%s
'
%
get_scheduler_token
(
arguments
[
'
--settings
'
]
),
'
--secret-key=%s
'
%
get_scheduler_token
(
settings
.
SCHEDULER_ACCOUNT
),
]
]
if
arguments
[
'
--verbose
'
]:
if
arguments
[
'
--verbose
'
]:
scheduler_arguments
.
append
(
'
-
'
+
arguments
[
'
--verbose
'
]
*
'
v
'
)
scheduler_arguments
.
append
(
'
-
'
+
arguments
[
'
--verbose
'
]
*
'
v
'
)
...
@@ -268,11 +268,12 @@ def main(user_input=None):
...
@@ -268,11 +268,12 @@ def main(user_input=None):
arguments
[
'
--scheduler-log
'
],
qconf_exclude
,
delay
=
5
)
arguments
[
'
--scheduler-log
'
],
qconf_exclude
,
delay
=
5
)
# Worker, also based on Twisted
# Worker, also based on Twisted
from
..backend.models
import
Worker
worker_arguments
=
[
worker_arguments
=
[
WORKER_BIN
,
WORKER_BIN
,
'
--prefix=%s
'
%
arguments
[
'
--prefix
'
],
'
--prefix=%s
'
%
arguments
[
'
--prefix
'
],
'
--port=10001
'
,
#scheduler port
'
--port=10001
'
,
#scheduler port
'
--name=
node1
'
,
#node name on the scheduler (look at queue config)
'
--name=
%s
'
%
Worker
.
objects
.
order_by
(
'
id
'
).
first
().
name
,
'
--period=%s
'
%
arguments
[
'
--period
'
],
#seconds
'
--period=%s
'
%
arguments
[
'
--period
'
],
#seconds
'
--cores=%s
'
%
arguments
[
'
--cores
'
],
'
--cores=%s
'
%
arguments
[
'
--cores
'
],
'
--keep-erred-configuration
'
,
'
--keep-erred-configuration
'
,
...
...
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