Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Base Worker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Workers
Base Worker
Commits
acbb8cf5
Commit
acbb8cf5
authored
2 years ago
by
NolanB
Browse files
Options
Downloads
Patches
Plain Diff
update code and modif the path of SAMPLES_DIR and tests
parent
a4da0845
No related branches found
No related tags found
1 merge request
!265
Only use files when computing model archive hash
Pipeline
#79870
passed
2 years ago
Stage: test
Stage: build
Stage: release
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arkindex_worker/worker/training.py
+3
-12
3 additions, 12 deletions
arkindex_worker/worker/training.py
tests/conftest.py
+1
-1
1 addition, 1 deletion
tests/conftest.py
tests/test_elements_worker/test_training.py
+1
-1
1 addition, 1 deletion
tests/test_elements_worker/test_training.py
with
5 additions
and
14 deletions
arkindex_worker/worker/training.py
+
3
−
12
View file @
acbb8cf5
...
...
@@ -50,23 +50,15 @@ def create_archive(path: DirPath) -> Tuple[Path, Hash, FileSize, Hash]:
# Create an uncompressed tar archive with all the needed files
# Files hierarchy ifs kept in the archive.
file_list
=
[]
with
tarfile
.
open
(
path_to_tar_archive
,
"
w
"
)
as
tar
:
for
p
in
path
.
glob
(
"
**/*
"
):
x
=
p
.
relative_to
(
path
)
tar
.
add
(
p
,
arcname
=
x
,
recursive
=
False
)
if
p
.
is_dir
():
continue
file_list
.
append
(
p
)
with
tarfile
.
open
(
path_to_tar_archive
,
"
w
"
)
as
tar
:
tar
.
add
(
path
)
file_list
=
[
member
for
member
in
tar
.
getnames
()
if
os
.
path
.
isfile
(
member
)]
# Sort by path
file_list
.
sort
()
# Compute hash of the files
for
file_path
in
file_list
:
print
(
"
BOOM PATH
"
,
file_path
)
with
open
(
file_path
,
"
rb
"
)
as
file_data
:
for
chunk
in
iter
(
lambda
:
file_data
.
read
(
CHUNK_SIZE
),
b
""
):
content_hasher
.
update
(
chunk
)
...
...
@@ -102,7 +94,6 @@ class TrainingMixin(object):
model_id
:
str
,
tag
:
Optional
[
str
]
=
None
,
description
:
Optional
[
str
]
=
None
,
use_parent_folder
=
False
,
):
"""
This method creates a model archive and its associated hash,
...
...
This diff is collapsed.
Click to expand it.
tests/conftest.py
+
1
−
1
View file @
acbb8cf5
...
...
@@ -26,7 +26,7 @@ from arkindex_worker.worker import BaseWorker, ElementsWorker
from
arkindex_worker.worker.transcription
import
TextOrientation
FIXTURES_DIR
=
Path
(
__file__
).
resolve
().
parent
/
"
data
"
SAMPLES_DIR
=
Path
(
__file__
).
resolve
().
parent
/
"
samples
"
SAMPLES_DIR
=
Path
(
"
tests
"
)
/
"
samples
"
__yaml_cache
=
{}
...
...
This diff is collapsed.
Click to expand it.
tests/test_elements_worker/test_training.py
+
1
−
1
View file @
acbb8cf5
...
...
@@ -58,7 +58,7 @@ def test_create_archive_with_subfolder(model_file_dir_with_subfolder):
assert
(
hash
==
"
e2fa86cefc33b24502ad4151a638dd29
"
),
"
Hash was not properly computed
"
assert
300
<
size
<
1
2
00
assert
300
<
size
<
1
5
00
assert
not
os
.
path
.
exists
(
zst_archive_path
),
"
Auto removal failed
"
...
...
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