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
7d5ad71e
Commit
7d5ad71e
authored
3 years ago
by
Eva Bardou
Browse files
Options
Downloads
Patches
Plain Diff
Change TASK_ID to PONOS_TASK
parent
4a60ef63
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!90
Change TASK_ID to PONOS_TASK
Pipeline
#78441
passed
3 years ago
Stage: test
Stage: build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex_worker/worker/base.py
+3
-5
3 additions, 5 deletions
arkindex_worker/worker/base.py
tests/conftest.py
+2
-2
2 additions, 2 deletions
tests/conftest.py
with
5 additions
and
7 deletions
arkindex_worker/worker/base.py
+
3
−
5
View file @
7d5ad71e
...
...
@@ -136,16 +136,15 @@ class BaseWorker(object):
if
self
.
args
.
database
is
not
None
:
self
.
use_cache
=
True
task_id
=
os
.
environ
.
get
(
"
PONOS_TASK
"
)
if
self
.
use_cache
is
True
:
if
self
.
args
.
database
is
not
None
:
assert
os
.
path
.
isfile
(
self
.
args
.
database
),
f
"
Database in
{
self
.
args
.
database
}
does not exist
"
self
.
cache_path
=
self
.
args
.
database
elif
os
.
environ
.
get
(
"
TASK_ID
"
):
cache_dir
=
os
.
path
.
join
(
os
.
environ
.
get
(
"
PONOS_DATA
"
,
"
/data
"
),
os
.
environ
.
get
(
"
TASK_ID
"
)
)
elif
task_id
:
cache_dir
=
os
.
path
.
join
(
os
.
environ
.
get
(
"
PONOS_DATA
"
,
"
/data
"
),
task_id
)
assert
os
.
path
.
isdir
(
cache_dir
),
f
"
Missing task cache in
{
cache_dir
}
"
self
.
cache_path
=
os
.
path
.
join
(
cache_dir
,
"
db.sqlite
"
)
else
:
...
...
@@ -157,7 +156,6 @@ class BaseWorker(object):
logger
.
debug
(
"
Cache is disabled
"
)
# Merging parents caches (if there are any) in the current task local cache, unless the database got overridden
task_id
=
os
.
environ
.
get
(
"
TASK_ID
"
)
if
self
.
use_cache
and
self
.
args
.
database
is
None
and
task_id
is
not
None
:
task
=
self
.
request
(
"
RetrieveTaskFromAgent
"
,
id
=
task_id
)
merge_parents_cache
(
...
...
This diff is collapsed.
Click to expand it.
tests/conftest.py
+
2
−
2
View file @
7d5ad71e
...
...
@@ -174,11 +174,11 @@ def mock_elements_worker(monkeypatch, mock_worker_version_api):
@pytest.fixture
def
mock_base_worker_with_cache
(
mocker
,
monkeypatch
,
mock_worker_version_api
):
"""
Build a BaseWorker using SQLite cache, also mocking a TASK
_ID
"""
"""
Build a BaseWorker using SQLite cache, also mocking a
PONOS_
TASK
"""
monkeypatch
.
setattr
(
sys
,
"
argv
"
,
[
"
worker
"
])
worker
=
BaseWorker
(
use_cache
=
True
)
monkeypatch
.
setenv
(
"
TASK
_ID
"
,
"
my_task
"
)
monkeypatch
.
setenv
(
"
PONOS_
TASK
"
,
"
my_task
"
)
return
worker
...
...
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