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
71e1d8fb
Commit
71e1d8fb
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[backend] By default, make workers inactive
parent
77d975ca
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/migrations/0002_scheduler_addons.py
+5
-0
5 additions, 0 deletions
beat/web/backend/migrations/0002_scheduler_addons.py
beat/web/backend/models.py
+6
-10
6 additions, 10 deletions
beat/web/backend/models.py
with
11 additions
and
10 deletions
beat/web/backend/migrations/0002_scheduler_addons.py
+
5
−
0
View file @
71e1d8fb
...
@@ -58,6 +58,11 @@ class Migration(migrations.Migration):
...
@@ -58,6 +58,11 @@ class Migration(migrations.Migration):
old_name
=
'
nb_cores_per_slot
'
,
old_name
=
'
nb_cores_per_slot
'
,
new_name
=
'
cores_per_slot
'
,
new_name
=
'
cores_per_slot
'
,
),
),
migrations
.
AlterField
(
model_name
=
'
worker
'
,
name
=
'
active
'
,
field
=
models
.
BooleanField
(
default
=
False
,
help_text
=
'
If this worker is usable presently
'
),
),
migrations
.
RenameField
(
migrations
.
RenameField
(
model_name
=
'
worker
'
,
model_name
=
'
worker
'
,
old_name
=
'
nb_cores
'
,
old_name
=
'
nb_cores
'
,
...
...
This diff is collapsed.
Click to expand it.
beat/web/backend/models.py
+
6
−
10
View file @
71e1d8fb
...
@@ -50,10 +50,11 @@ from ..common.texts import Messages
...
@@ -50,10 +50,11 @@ from ..common.texts import Messages
class
EnvironmentManager
(
models
.
Manager
):
class
EnvironmentManager
(
models
.
Manager
):
def
get_by_natural_key
(
self
,
name
,
version
):
def
get_by_natural_key
(
self
,
key
):
name
,
version
=
key
.
split
()
return
self
.
get
(
return
self
.
get
(
name
=
name
,
name
=
name
,
version
=
version
,
version
=
version
[
1
:
-
1
]
,
)
)
...
@@ -114,18 +115,13 @@ class Environment(Shareable):
...
@@ -114,18 +115,13 @@ class Environment(Shareable):
def
natural_key
(
self
):
def
natural_key
(
self
):
return
(
self
.
name
,
self
.
version
)
return
self
.
fullname
(
)
#_____ Utilities __________
#_____ Utilities __________
def
fullname
(
self
):
def
fullname
(
self
):
retval
=
'
%s (%s)
'
%
(
return
'
%s (%s)
'
%
(
self
.
name
,
self
.
version
)
self
.
name
,
self
.
version
,
)
if
not
self
.
active
:
retval
+=
'
[INACTIVE]
'
return
retval
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
...
@@ -160,7 +156,7 @@ class Worker(models.Model):
...
@@ -160,7 +156,7 @@ class Worker(models.Model):
active
=
models
.
BooleanField
(
active
=
models
.
BooleanField
(
help_text
=
u
'
If this worker is usable presently
'
,
help_text
=
u
'
If this worker is usable presently
'
,
default
=
Tru
e
,
default
=
Fals
e
,
)
)
cores
=
models
.
PositiveIntegerField
()
cores
=
models
.
PositiveIntegerField
()
...
...
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