Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
atdb-ldv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
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
atdb-ldv
Commits
6e7eccbc
Commit
6e7eccbc
authored
1 year ago
by
Nico Vermaas
Browse files
Options
Downloads
Patches
Plain Diff
add update-summary-flag endpoint, in case of data migration
parent
2b5e7af5
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!344
add update-summary-flag endpoint for possible data migration
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
atdb/taskdatabase/models.py
+1
-0
1 addition, 0 deletions
atdb/taskdatabase/models.py
atdb/taskdatabase/urls.py
+1
-0
1 addition, 0 deletions
atdb/taskdatabase/urls.py
atdb/taskdatabase/views.py
+26
-1
26 additions, 1 deletion
atdb/taskdatabase/views.py
with
28 additions
and
1 deletion
atdb/taskdatabase/models.py
+
1
−
0
View file @
6e7eccbc
...
...
@@ -154,6 +154,7 @@ def check_if_summary(task):
for
tar
in
tars
:
if
'
summary
'
in
tar
[
'
basename
'
]:
# a summary tarball was found, this task is a summary task
logger
.
info
(
f
'
task
{
task
.
id
}
with workflow
{
task
.
workflow
}
is a summary task
'
)
return
True
except
:
# no 'tar_archive' was found
...
...
This diff is collapsed.
Click to expand it.
atdb/taskdatabase/urls.py
+
1
−
0
View file @
6e7eccbc
...
...
@@ -133,4 +133,5 @@ urlpatterns = [
#some migration and repair endpoints
path
(
'
tasks/repair/associate-activities/
'
,
views
.
AssociateActivities
,
name
=
'
associate-activities
'
),
path
(
'
tasks/repair/update-activity/<sas_id>
'
,
views
.
UpdateActivitySasId
,
name
=
'
update-activity-sasid
'
),
path
(
'
tasks/repair/update-summary-flag/<task_id>
'
,
views
.
UpdateSummaryFlag
,
name
=
'
update-summary-flag
'
),
]
This diff is collapsed.
Click to expand it.
atdb/taskdatabase/views.py
+
26
−
1
View file @
6e7eccbc
...
...
@@ -24,6 +24,8 @@ from rest_framework.request import Request
from
django.conf
import
settings
from
.models
import
Activity
,
Task
,
Workflow
,
LogEntry
,
Configuration
,
Job
,
PostProcessingRule
,
Monitor
,
LatestMonitor
from
.models
import
check_if_summary
from
.services.common
import
State
from
.services.signals
import
disconnect_signals
,
connect_signals
from
.tables
import
TaskTable
...
...
@@ -1685,7 +1687,7 @@ class GetUniqueValuesForKey(generics.ListAPIView):
@staff_member_required
def
AssociateActivities
(
request
):
# disconnect the signals to avoid
save recursion
# disconnect the signals to avoid
unneccesary updates
disconnect_signals
()
#tasks = Task.objects.filter(activity__isnull=True)[:10000]
...
...
@@ -1734,3 +1736,26 @@ def UpdateActivitySasId(request, sas_id):
'
total
'
:
total
})
def
UpdateSummaryFlag
(
request
,
task_id
):
# this function is called externally to avoid worker timeouts
# http://localhost:8000/atdb/tasks/repair/update-summary-flag/12345
try
:
task
=
Task
.
objects
.
get
(
id
=
task_id
)
if
not
task
.
is_summary
:
is_summary
=
check_if_summary
(
task
)
if
is_summary
:
# disconnect the signals to avoid unneccesary updates
disconnect_signals
()
task
.
save
()
connect_signals
()
except
Exception
as
error
:
logger
.
error
(
error
)
return
JsonResponse
({
'
error
'
:
str
(
error
)
})
return
JsonResponse
({
'
is_summary
'
:
task
.
is_summary
})
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