Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
ldv_datamanagement_tasks
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
LDV
ldv_datamanagement_tasks
Commits
a277998e
Commit
a277998e
authored
2 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
Add first implementation
parent
89420b4a
Branches
Branches containing commit
No related tags found
1 merge request
!11
Fix output sizes
Pipeline
#40608
failed
2 years ago
Stage: lint
Stage: test
Stage: package
Stage: integration
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
atdb/communication.py
+8
-1
8 additions, 1 deletion
atdb/communication.py
atdb/fix.py
+35
-0
35 additions, 0 deletions
atdb/fix.py
atdb/main.py
+3
-0
3 additions, 0 deletions
atdb/main.py
with
46 additions
and
1 deletion
atdb/communication.py
+
8
−
1
View file @
a277998e
"""
This module is responsible for the communication to and from ATDB
"""
from
typing
import
List
,
Generator
from
argparse
import
Namespace
from
typing
import
List
,
Generator
import
requests
...
...
@@ -122,6 +123,12 @@ class APIConnector:
for
item
in
drf_reply
.
results
:
yield
item
def
update_task
(
self
,
task_id
,
content
):
"""
Change the whole task content
"""
self
.
_request_path
(
"
PUT
"
,
f
"
tasks/
{
task_id
}
"
,
content
=
content
)
def
change_task_status
(
self
,
task_id
,
status
)
->
None
:
"""
Change the status of a task
...
...
This diff is collapsed.
Click to expand it.
atdb/fix.py
0 → 100644
+
35
−
0
View file @
a277998e
import
atdb.communication
as
com
import
tqdm
def
aggregate_on_tree
(
tree
,
field
):
if
isinstance
(
tree
,
dict
)
and
field
in
tree
:
return
tree
[
field
]
elif
isinstance
(
tree
,
dict
):
total
=
0
for
value
in
tree
.
values
():
total
+=
aggregate_on_tree
(
value
,
field
)
return
total
elif
isinstance
(
tree
,
list
):
total
=
0
for
item
in
tree
:
total
+=
aggregate_on_tree
(
item
,
field
)
return
total
else
:
return
0
def
compute_output_sizes
(
outputs
):
if
outputs
is
not
None
:
return
aggregate_on_tree
({
key
:
value
for
key
,
value
in
outputs
.
items
if
key
!=
'
ingest
'
},
'
size
'
)
else
:
return
0
def
fix_computed_sizes
(
connector
):
for
task
in
tqdm
.
tqdm
(
connector
.
list_iter
(
'
tasks
'
)):
task_id
=
task
[
'
id
'
]
total_output_size
=
compute_output_sizes
(
task
[
'
outputs
'
])
task
[
'
size_processed
'
]
=
total_output_size
connector
.
update_task
(
task_id
,
task
)
def
fix
(
args
):
connector
=
com
.
APIConnector
.
from_args
(
args
)
fix_computed_sizes
(
connector
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
atdb/main.py
+
3
−
0
View file @
a277998e
...
...
@@ -61,6 +61,9 @@ def parse_args() -> (Namespace, ArgumentParser):
prune_parser
=
subparser
.
add_parser
(
"
prune
"
)
prune_parser
.
add_argument
(
"
--workflow_id
"
,
help
=
"
Filters by workflow id
"
)
prune_parser
.
add_argument
(
"
--status
"
,
help
=
"
Filter by status
"
)
_
=
subparser
.
add_parser
(
"
fix
"
)
return
parser
.
parse_args
(),
parser
...
...
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