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
200ea938
Commit
200ea938
authored
4 years ago
by
Bastien Abadie
Browse files
Options
Downloads
Patches
Plain Diff
Do not store use_cache
parent
0a4bbe4b
No related branches found
No related tags found
1 merge request
!67
Store created elements in a local SQLite database
Pipeline
#78299
passed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex_worker/worker.py
+5
-4
5 additions, 4 deletions
arkindex_worker/worker.py
tests/test_base_worker.py
+1
-2
1 addition, 2 deletions
tests/test_base_worker.py
with
6 additions
and
6 deletions
arkindex_worker/worker.py
+
5
−
4
View file @
200ea938
...
...
@@ -50,9 +50,7 @@ class BaseWorker(object):
logger
.
info
(
f
"
Worker will use
{
self
.
work_dir
}
as working directory
"
)
self
.
use_cache
=
use_cache
if
self
.
use_cache
:
if
use_cache
is
True
:
if
os
.
environ
.
get
(
"
TASK_ID
"
)
and
os
.
path
.
isdir
(
CACHE_DIR
):
cache_path
=
os
.
path
.
join
(
CACHE_DIR
,
"
db.sqlite
"
)
else
:
...
...
@@ -60,6 +58,9 @@ class BaseWorker(object):
self
.
cache
=
LocalDB
(
cache_path
)
self
.
cache
.
create_tables
()
else
:
self
.
cache
=
None
logger
.
debug
(
"
Cache is disabled
"
)
@property
def
is_read_only
(
self
):
...
...
@@ -466,7 +467,7 @@ class ElementsWorker(BaseWorker):
for
element
in
elements
:
self
.
report
.
add_element
(
parent
.
id
,
element
[
"
type
"
])
if
self
.
use_
cache
:
if
self
.
cache
:
# Store elements in local cache
try
:
parent_id_hex
=
convert_str_uuid_to_hex
(
parent
.
id
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_base_worker.py
+
1
−
2
View file @
200ea938
...
...
@@ -33,8 +33,7 @@ def test_init_with_local_cache(monkeypatch):
assert
worker
.
work_dir
==
os
.
path
.
expanduser
(
"
~/.local/share/arkindex
"
)
assert
worker
.
worker_version_id
==
"
12341234-1234-1234-1234-123412341234
"
assert
worker
.
use_cache
assert
worker
.
cache
assert
worker
.
cache
is
not
None
def
test_init_var_ponos_data_given
(
monkeypatch
):
...
...
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