Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Generic Training Dataset
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
Arkindex
Workers
Generic Training Dataset
Commits
f3a8c17d
Commit
f3a8c17d
authored
1 year ago
by
Eva Bardou
Browse files
Options
Downloads
Patches
Plain Diff
Nit and bump
parent
316f067b
No related branches found
No related tags found
1 merge request
!8
New DatasetExtractor using a DatasetWorker
Pipeline
#138726
passed
1 year ago
Stage: test
Stage: build
Stage: release
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
requirements.txt
+1
-1
1 addition, 1 deletion
requirements.txt
tests/test_worker.py
+1
-1
1 addition, 1 deletion
tests/test_worker.py
worker_generic_training_dataset/worker.py
+9
-5
9 additions, 5 deletions
worker_generic_training_dataset/worker.py
with
11 additions
and
7 deletions
requirements.txt
+
1
−
1
View file @
f3a8c17d
arkindex-base-worker
@
git+https://gitlab.teklia.com/workers/base-worker.git@master
arkindex-base-worker
==0.3.5rc4
arkindex-export
==0.1.7
This diff is collapsed.
Click to expand it.
tests/test_worker.py
+
1
−
1
View file @
f3a8c17d
...
...
@@ -19,7 +19,7 @@ def test_process_split(tmp_path, downloaded_images):
worker
=
DatasetExtractor
()
# Parse some arguments
worker
.
args
=
Namespace
(
database
=
None
)
worker
.
data_folder
=
tmp_path
worker
.
data_folder
_path
=
tmp_path
worker
.
configure_cache
()
worker
.
cached_images
=
dict
()
...
...
This diff is collapsed.
Click to expand it.
worker_generic_training_dataset/worker.py
+
9
−
5
View file @
f3a8c17d
...
...
@@ -62,7 +62,8 @@ class DatasetExtractor(DatasetWorker):
self
.
download_latest_export
()
def
configure_storage
(
self
)
->
None
:
self
.
data_folder
=
Path
(
tempfile
.
mkdtemp
(
suffix
=
"
-arkindex-data
"
))
self
.
data_folder
=
tempfile
.
TemporaryDirectory
(
suffix
=
"
-arkindex-data
"
)
self
.
data_folder_path
=
Path
(
self
.
data_folder
.
name
)
# Initialize db that will be written
self
.
configure_cache
()
...
...
@@ -71,7 +72,7 @@ class DatasetExtractor(DatasetWorker):
self
.
cached_images
=
dict
()
# Where to save the downloaded images
self
.
images_folder
=
self
.
data_folder
/
"
images
"
self
.
images_folder
=
self
.
data_folder
_path
/
"
images
"
self
.
images_folder
.
mkdir
(
parents
=
True
)
logger
.
info
(
f
"
Images will be saved at `
{
self
.
images_folder
}
`.
"
)
...
...
@@ -80,8 +81,8 @@ class DatasetExtractor(DatasetWorker):
Create an SQLite database compatible with base-worker cache and initialize it.
"""
self
.
use_cache
=
True
self
.
cache_path
:
Path
=
self
.
data_folder
/
"
db.sqlite
"
logger
.
info
(
f
"
Cached database will be saved at `
{
self
.
data_folder
}
`.
"
)
self
.
cache_path
:
Path
=
self
.
data_folder
_path
/
"
db.sqlite
"
logger
.
info
(
f
"
Cached database will be saved at `
{
self
.
cache_path
}
`.
"
)
init_cache_db
(
self
.
cache_path
)
...
...
@@ -318,7 +319,10 @@ class DatasetExtractor(DatasetWorker):
# TAR + ZSTD the cache and the images folder, and store as task artifact
zstd_archive_path
:
Path
=
self
.
work_dir
/
f
"
{
dataset
.
id
}
.zstd
"
logger
.
info
(
f
"
Compressing the images to
{
zstd_archive_path
}
"
)
create_tar_zst_archive
(
source
=
self
.
data_folder
,
destination
=
zstd_archive_path
)
create_tar_zst_archive
(
source
=
self
.
data_folder_path
,
destination
=
zstd_archive_path
)
self
.
data_folder
.
cleanup
()
def
main
():
...
...
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