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
a33e1208
Commit
a33e1208
authored
3 years ago
by
Valentin Rigal
Browse files
Options
Downloads
Patches
Plain Diff
Add real worker version values to the ML report
parent
bde7000a
No related branches found
No related tags found
1 merge request
!149
Add real worker version values to the ML report
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arkindex_worker/reporting.py
+6
-4
6 additions, 4 deletions
arkindex_worker/reporting.py
arkindex_worker/worker/__init__.py
+7
-3
7 additions, 3 deletions
arkindex_worker/worker/__init__.py
arkindex_worker/worker/base.py
+3
-0
3 additions, 0 deletions
arkindex_worker/worker/base.py
with
16 additions
and
7 deletions
arkindex_worker/reporting.py
+
6
−
4
View file @
a33e1208
...
...
@@ -10,11 +10,13 @@ from arkindex_worker import logger
class
Reporter
(
object
):
def
__init__
(
self
,
name
):
# TODO: use real data from workers
def
__init__
(
self
,
name
=
"
Unknown worker
"
,
slug
=
"
unknown-slug
"
,
version
=
None
,
**
kwargs
):
self
.
report_data
=
{
"
slug
"
:
name
,
"
version
"
:
"
0.0
"
,
"
name
"
:
name
,
"
slug
"
:
slug
,
"
version
"
:
version
,
"
started
"
:
datetime
.
utcnow
().
isoformat
(),
"
elements
"
:
{},
}
...
...
This diff is collapsed.
Click to expand it.
arkindex_worker/worker/__init__.py
+
7
−
3
View file @
a33e1208
...
...
@@ -39,9 +39,6 @@ class ElementsWorker(
def
__init__
(
self
,
description
=
"
Arkindex Elements Worker
"
,
support_cache
=
False
):
super
().
__init__
(
description
,
support_cache
)
# Add report concerning elements
self
.
report
=
Reporter
(
"
unknown worker
"
)
# Add mandatory argument to process elements
self
.
parser
.
add_argument
(
"
--elements-list
"
,
...
...
@@ -93,6 +90,13 @@ class ElementsWorker(
),
"
Worker must be configured to access its process activity state
"
return
self
.
process_information
.
get
(
"
activity_state
"
)
==
"
ready
"
def
configure
(
self
):
super
().
configure
()
# Add report concerning elements
self
.
report
=
Reporter
(
**
self
.
worker_details
,
version
=
getattr
(
self
,
"
worker_version_id
"
,
None
)
)
def
run
(
self
):
"""
Process every elements from the provided list
...
...
This diff is collapsed.
Click to expand it.
arkindex_worker/worker/base.py
+
3
−
0
View file @
a33e1208
...
...
@@ -145,16 +145,19 @@ class BaseWorker(object):
f
"
Loaded worker
{
worker_version
[
'
worker
'
][
'
name
'
]
}
revision
{
worker_version
[
'
revision
'
][
'
hash
'
][
0
:
7
]
}
from API
"
)
self
.
config
=
worker_version
[
"
configuration
"
][
"
configuration
"
]
self
.
worker_details
=
worker_version
[
"
worker
"
]
required_secrets
=
worker_version
[
"
configuration
"
].
get
(
"
secrets
"
,
[])
elif
self
.
args
.
config
:
# Load config from YAML file
self
.
config
=
yaml
.
safe_load
(
self
.
args
.
config
)
self
.
worker_details
=
{
"
name
"
:
"
Local worker
"
}
required_secrets
=
self
.
config
.
get
(
"
secrets
"
,
[])
logger
.
info
(
f
"
Running with local configuration from
{
self
.
args
.
config
.
name
}
"
)
else
:
self
.
config
=
{}
self
.
worker_details
=
{}
required_secrets
=
[]
logger
.
warning
(
"
Running without any extra configuration
"
)
...
...
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