Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LDV Specification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
ASTRON SDC
LDV Specification
Commits
4187ddef
Commit
4187ddef
authored
1 year ago
by
Klaas Kliffen
Browse files
Options
Downloads
Patches
Plain Diff
Add propagation of fields
parent
0938a70c
No related branches found
Branches containing commit
No related tags found
1 merge request
!104
Propagate extra fields form group into WorkSpecifications
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ldvspec/lofardata/view_helpers/specification.py
+25
-9
25 additions, 9 deletions
ldvspec/lofardata/view_helpers/specification.py
with
25 additions
and
9 deletions
ldvspec/lofardata/view_helpers/specification.py
+
25
−
9
View file @
4187ddef
from
typing
import
List
from
django.contrib.auth.models
import
User
from
lofardata.models
import
Group
,
WorkSpecification
...
...
@@ -12,26 +11,43 @@ def set_post_submit_values(specification, user):
def
split_obs_ids_string
(
obs_ids_string
:
str
)
->
List
[
str
]:
return
[
obs_id
.
strip
()
for
obs_id
in
obs_ids_string
.
split
(
'
,
'
)]
return
[
obs_id
.
strip
()
for
obs_id
in
obs_ids_string
.
split
(
"
,
"
)]
def
create_work_specifications_for_group
(
group
:
Group
,
created_by
:
User
,
obs_ids
:
List
[
str
],
batch_size
:
int
)
->
List
[
WorkSpecification
]:
def
create_work_specifications_for_group
(
group
:
Group
,
created_by
:
User
,
obs_ids
:
List
[
str
],
batch_size
:
int
)
->
List
[
WorkSpecification
]:
work_specs
:
List
[
WorkSpecification
]
=
[]
for
obs_id
in
obs_ids
:
work_specs
.
append
(
create_work_specification_for_group
(
group
,
created_by
,
obs_id
,
batch_size
))
work_specs
.
append
(
create_work_specification_for_group
(
group
,
created_by
,
obs_id
,
batch_size
)
)
return
work_specs
def
propagate_group_properties_to_workspecification
(
group
:
Group
,
workspecification
:
WorkSpecification
):
def
propagate_group_properties_to_workspecification
(
group
:
Group
,
workspecification
:
WorkSpecification
):
workspecification
.
processing_site
=
group
.
processing_site
workspecification
.
selected_workflow
=
group
.
selected_workflow
workspecification
.
selected_workflow_tag
=
group
.
selected_workflow_tag
def
create_work_specification_for_group
(
group
:
Group
,
created_by
:
User
,
obs_id
:
str
,
batch_size
:
int
)
->
WorkSpecification
:
# A WorkSpecification can not be it's own predecessor
if
workspecification
is
not
group
.
predecessor_specification
:
workspecification
.
predecessor_specification
=
group
.
predecessor_specification
for
filter_field
in
[
"
dataproduct_type
"
,
"
activity
"
,
"
project
"
,
"
location
"
]:
if
group
.
filters
is
not
None
and
filter_field
in
group
.
filters
:
workspecification
.
filters
[
filter_field
]
=
group
.
filters
[
filter_field
]
def
create_work_specification_for_group
(
group
:
Group
,
created_by
:
User
,
obs_id
:
str
,
batch_size
:
int
)
->
WorkSpecification
:
workspecification
=
WorkSpecification
(
filters
=
{
"
obs_id
"
:
obs_id
},
group
=
group
,
batch_size
=
batch_size
filters
=
{
"
obs_id
"
:
obs_id
},
group
=
group
,
batch_size
=
batch_size
)
propagate_group_properties_to_workspecification
(
group
,
workspecification
)
...
...
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