Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor 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
RadioObservatory
LOFAR
Commits
b73d7c13
Commit
b73d7c13
authored
4 years ago
by
Jörn Künsemöller
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-241
: Remove auto-created quota again, due to misleading ticket
parent
bd726f9b
No related branches found
No related tags found
1 merge request
!184
Resolve TMSS-241
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/src/tmss/tmssapp/models/specification.py
+23
-14
23 additions, 14 deletions
SAS/TMSS/src/tmss/tmssapp/models/specification.py
with
23 additions
and
14 deletions
SAS/TMSS/src/tmss/tmssapp/models/specification.py
+
23
−
14
View file @
b73d7c13
...
@@ -286,20 +286,29 @@ class Project(NamedCommonPK):
...
@@ -286,20 +286,29 @@ class Project(NamedCommonPK):
project_category
=
ForeignKey
(
'
ProjectCategory
'
,
null
=
True
,
on_delete
=
PROTECT
,
help_text
=
'
Project category.
'
)
project_category
=
ForeignKey
(
'
ProjectCategory
'
,
null
=
True
,
on_delete
=
PROTECT
,
help_text
=
'
Project category.
'
)
period_category
=
ForeignKey
(
'
PeriodCategory
'
,
null
=
True
,
on_delete
=
PROTECT
,
help_text
=
'
Period category.
'
)
period_category
=
ForeignKey
(
'
PeriodCategory
'
,
null
=
True
,
on_delete
=
PROTECT
,
help_text
=
'
Period category.
'
)
# also create default project quotas when projects are created
# JK, 29/07/20 - after discussion with Sander, it turns out that the ticket TMSS-277 was a misunderstanding.
def
save
(
self
,
force_insert
=
False
,
force_update
=
False
,
using
=
None
,
update_fields
=
None
):
# 'default' does not refer to 'default values' that are supposed to be filled in by the backend.
creating
=
self
.
_state
.
adding
# True on create, False on update
# It was meant to be 'resource_types displayed in the frontend by default', where the other resource_types are
super
().
save
(
force_insert
,
force_update
,
using
,
update_fields
)
# optionally added to the set of quota. These can then be customized in the frontend and are created by the
if
creating
:
# frontend in the backend, but no quota are intended to be added automatically. So nothing is really needed in
# todo: review these defaults for being sensible
# the backend for this (apart from the set of predefined resource_types).
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
lta_storage
"
),
value
=
1024
^
4
,
project
=
self
)
# There was some open question on whether there may be a required subset of quota that have to be enforced. So
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
cep_storage
"
),
value
=
1024
^
4
,
project
=
self
)
# I'll leave this in for now, until that question is cleared up.
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
cep_processing_time
"
),
value
=
60
*
60
*
24
,
project
=
self
)
#
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
lofar_observing_time
"
),
value
=
60
*
60
*
24
,
project
=
self
)
# # also create default project quotas when projects are created
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
lofar_observing_time_prio_a
"
),
value
=
60
*
60
*
12
,
project
=
self
)
# def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
lofar_observing_time_prio_b
"
),
value
=
60
*
60
*
12
,
project
=
self
)
# creating = self._state.adding # True on create, False on update
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
support_time
"
),
value
=
60
*
60
*
6
,
project
=
self
)
# super().save(force_insert, force_update, using, update_fields)
ProjectQuota
.
objects
.
create
(
resource_type
=
ResourceType
.
objects
.
get
(
name
=
"
number_of_triggers
"
),
value
=
42
,
project
=
self
)
# if creating:
# # todo: review these defaults for being sensible
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="lta_storage"), value=1024^4, project=self)
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="cep_storage"), value=1024^4, project=self)
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="cep_processing_time"), value=60*60*24, project=self)
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="lofar_observing_time"), value=60*60*24, project=self)
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="lofar_observing_time_prio_a"), value=60*60*12, project=self)
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="lofar_observing_time_prio_b"), value=60*60*12, project=self)
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="support_time"), value=60*60*6, project=self)
# ProjectQuota.objects.create(resource_type=ResourceType.objects.get(name="number_of_triggers"), value=42, project=self)
class
ProjectQuota
(
Model
):
class
ProjectQuota
(
Model
):
...
...
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