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
2819599c
Commit
2819599c
authored
2 years ago
by
Chaza Abdelwahab
Browse files
Options
Downloads
Patches
Plain Diff
push for debug
parent
e0c32a44
Branches
117-move-developer-setup-in-a-dedicated-method
No related tags found
1 merge request
!176
Draft: Resolve "Move developer setup in a dedicated method"
Pipeline
#79284
failed
2 years ago
Stage: test
Stage: build
Stage: release
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex_worker/worker/__init__.py
+8
-2
8 additions, 2 deletions
arkindex_worker/worker/__init__.py
arkindex_worker/worker/base.py
+5
-5
5 additions, 5 deletions
arkindex_worker/worker/base.py
with
13 additions
and
7 deletions
arkindex_worker/worker/__init__.py
+
8
−
2
View file @
2819599c
...
...
@@ -67,6 +67,7 @@ class ElementsWorker(
"""
def
__init__
(
self
,
description
=
"
Arkindex Elements Worker
"
,
support_cache
=
False
):
print
(
"
in __init__ in __init__.py before super
"
)
super
().
__init__
(
description
,
support_cache
)
# Add mandatory argument to process elements
self
.
parser
.
add_argument
(
...
...
@@ -81,6 +82,7 @@ class ElementsWorker(
nargs
=
"
+
"
,
help
=
"
One or more Arkindex element ID
"
,
)
print
(
"
in __init__ in __init__.py after super
"
)
self
.
classes
=
{}
...
...
@@ -135,8 +137,12 @@ class ElementsWorker(
return
self
.
process_information
.
get
(
"
activity_state
"
)
==
"
ready
"
def
configure
(
self
):
super
().
configure
()
super
().
configure_cache
()
print
(
"
in configure in __init__.py
"
)
if
self
.
is_read_only
:
super
().
configure_for_developers
()
else
:
super
().
configure
()
super
().
configure_cache
()
# Add report concerning elements
self
.
report
=
Reporter
(
...
...
This diff is collapsed.
Click to expand it.
arkindex_worker/worker/base.py
+
5
−
5
View file @
2819599c
...
...
@@ -57,7 +57,7 @@ class BaseWorker(object):
:param support_cache bool: Whether or not this worker supports the cache database.
Override the constructor and set this parameter to start using the cache database.
"""
print
(
"
in __init__ in base.py
"
)
self
.
parser
=
argparse
.
ArgumentParser
(
description
=
description
)
# Setup workdir either in Ponos environment or on host's home
...
...
@@ -121,6 +121,9 @@ class BaseWorker(object):
# Call potential extra arguments
self
.
add_arguments
()
# CLI args are stored on the instance so that implementations can access them
self
.
args
=
self
.
parser
.
parse_args
()
@property
def
is_read_only
(
self
)
->
bool
:
"""
...
...
@@ -133,8 +136,6 @@ class BaseWorker(object):
return
self
.
args
.
dev
or
self
.
worker_version_id
is
None
def
configure_for_developers
(
self
):
# CLI args are stored on the instance so that implementations can access them
self
.
args
=
self
.
parser
.
parse_args
()
# Setup logging level
if
self
.
args
.
verbose
:
logger
.
setLevel
(
logging
.
DEBUG
)
...
...
@@ -160,8 +161,7 @@ class BaseWorker(object):
"""
Configure worker using CLI args and environment variables.
"""
# CLI args are stored on the instance so that implementations can access them
self
.
args
=
self
.
parser
.
parse_args
()
assert
not
self
.
is_read_only
# Build Arkindex API client from environment variables
self
.
api_client
=
ArkindexClient
(
**
options_from_env
())
logger
.
debug
(
f
"
Setup Arkindex API client on
{
self
.
api_client
.
document
.
url
}
"
)
...
...
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