Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
3369dc5e
Verified
Commit
3369dc5e
authored
2 years ago
by
Erwan Rouchet
Browse files
Options
Downloads
Patches
Plain Diff
Add training process attributes on RetrieveWorkerRun
parent
267d7ce3
No related branches found
Branches containing commit
Tags
1.3.2-rc1
Tags containing commit
1 merge request
!1793
Add training process attributes on RetrieveWorkerRun
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/dataimport/serializers/imports.py
+26
-18
26 additions, 18 deletions
arkindex/dataimport/serializers/imports.py
arkindex/dataimport/tests/test_workerruns.py
+4
-0
4 additions, 0 deletions
arkindex/dataimport/tests/test_workerruns.py
with
30 additions
and
18 deletions
arkindex/dataimport/serializers/imports.py
+
26
−
18
View file @
3369dc5e
...
...
@@ -53,7 +53,28 @@ class DataImportLightSerializer(serializers.ModelSerializer):
read_only_fields
=
(
'
id
'
,
'
state
'
,
'
mode
'
,
'
corpus
'
,
'
creator
'
,
'
workflow
'
,
'
activity_state
'
)
class
DataImportSerializer
(
DataImportLightSerializer
):
class
DataImportTrainingSerializer
(
DataImportLightSerializer
):
model_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
train_folder_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
validation_folder_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
test_folder_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
class
Meta
(
DataImportLightSerializer
.
Meta
):
fields
=
DataImportLightSerializer
.
Meta
.
fields
+
(
'
model_id
'
,
'
train_folder_id
'
,
'
validation_folder_id
'
,
'
test_folder_id
'
,
)
read_only_fields
=
DataImportLightSerializer
.
Meta
.
read_only_fields
+
(
'
model_id
'
,
'
train_folder_id
'
,
'
validation_folder_id
'
,
'
test_folder_id
'
,
)
class
DataImportSerializer
(
DataImportTrainingSerializer
):
"""
Serialize a data importing workflow with its settings
"""
...
...
@@ -82,14 +103,9 @@ class DataImportSerializer(DataImportLightSerializer):
source
=
'
template
'
,
style
=
{
'
base_template
'
:
'
input.html
'
}
)
# Training properties
model_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
train_folder_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
validation_folder_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
test_folder_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
class
Meta
(
DataImport
Light
Serializer
.
Meta
):
fields
=
DataImport
Light
Serializer
.
Meta
.
fields
+
(
class
Meta
(
DataImport
Training
Serializer
.
Meta
):
fields
=
DataImport
Training
Serializer
.
Meta
.
fields
+
(
'
files
'
,
'
revision
'
,
'
element
'
,
...
...
@@ -101,12 +117,8 @@ class DataImportSerializer(DataImportLightSerializer):
'
use_cache
'
,
'
use_gpu
'
,
'
template_id
'
,
'
model_id
'
,
'
train_folder_id
'
,
'
validation_folder_id
'
,
'
test_folder_id
'
,
)
read_only_fields
=
DataImport
Light
Serializer
.
Meta
.
read_only_fields
+
(
read_only_fields
=
DataImport
Training
Serializer
.
Meta
.
read_only_fields
+
(
'
files
'
,
'
revision
'
,
'
element
'
,
...
...
@@ -114,10 +126,6 @@ class DataImportSerializer(DataImportLightSerializer):
'
use_cache
'
,
'
use_gpu
'
,
'
template_id
'
,
'
model_id
'
,
'
train_folder_id
'
,
'
validation_folder_id
'
,
'
test_folder_id
'
,
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -426,7 +434,7 @@ class WorkerRunEditSerializer(WorkerRunSerializer):
worker_version
=
WorkerVersionSerializer
(
read_only
=
True
,
source
=
'
version
'
)
configuration
=
WorkerConfigurationSerializer
(
read_only
=
True
)
process
=
DataImport
Light
Serializer
(
read_only
=
True
,
source
=
'
dataimport
'
)
process
=
DataImport
Training
Serializer
(
read_only
=
True
,
source
=
'
dataimport
'
)
class
Meta
(
WorkerRunSerializer
.
Meta
):
fields
=
WorkerRunSerializer
.
Meta
.
fields
+
(
...
...
This diff is collapsed.
Click to expand it.
arkindex/dataimport/tests/test_workerruns.py
+
4
−
0
View file @
3369dc5e
...
...
@@ -79,6 +79,10 @@ def _deserialize_worker_process(process):
'
corpus
'
:
str
(
process
.
corpus
.
id
),
'
workflow
'
:
(
str
(
process
.
workflow
)
if
process
.
workflow
else
None
),
'
activity_state
'
:
process
.
activity_state
.
value
,
'
model_id
'
:
str
(
process
.
model_id
)
if
process
.
model_id
else
None
,
'
train_folder_id
'
:
str
(
process
.
train_folder_id
)
if
process
.
train_folder_id
else
None
,
'
test_folder_id
'
:
str
(
process
.
test_folder_id
)
if
process
.
test_folder_id
else
None
,
'
validation_folder_id
'
:
str
(
process
.
validation_folder_id
)
if
process
.
validation_folder_id
else
None
,
}
...
...
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