Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nrm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
argo
nrm
Commits
24bb769a
Commit
24bb769a
authored
Dec 21, 2018
by
Swann Perarnau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactor] move perfwrapper to new API
parent
4bca474a
Pipeline
#4757
passed with stages
in 2 minutes and 10 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
26 deletions
+21
-26
bin/argo-perf-wrapper
bin/argo-perf-wrapper
+21
-26
No files found.
bin/argo-perf-wrapper
View file @
24bb769a
...
...
@@ -4,12 +4,13 @@ from __future__ import print_function
import
argparse
import
logging
import
zmq
import
os
import
tempfile
import
subprocess
import
uuid
from
nrm
import
messaging
PUB_MSG
=
messaging
.
MSGTYPES
[
'down_event'
]
logger
=
logging
.
getLogger
(
'perf-wrapper'
)
...
...
@@ -22,30 +23,26 @@ class PerfWrapper(object):
pass
def
shutdown
(
self
):
update
=
{
'
type'
:
'application
'
,
'
event'
:
'
exit'
,
'uuid'
:
self
.
app_uuid
,
update
=
{
'
api'
:
'down_event
'
,
'
type'
:
'application_
exit'
,
'
application_
uuid'
:
self
.
app_uuid
,
}
self
.
downstream_pub_socket
.
send_json
(
update
)
msg
=
PUB_MSG
[
'application_exit'
](
**
update
)
self
.
downstream_event
.
sendmsg
(
msg
)
def
progress_report
(
self
,
progress
):
update
=
{
'
type'
:
'application
'
,
'
event
'
:
'progress'
,
update
=
{
'
api'
:
'down_event
'
,
'
type
'
:
'progress'
,
'payload'
:
progress
,
'uuid'
:
self
.
app_uuid
,
}
self
.
downstream_pub_socket
.
send_json
(
update
)
msg
=
PUB_MSG
[
'progress'
](
**
update
)
self
.
downstream_event
.
sendmsg
(
msg
)
def
setup
(
self
):
context
=
zmq
.
Context
()
self
.
downstream_pub_socket
=
context
.
socket
(
zmq
.
PUB
)
downstream_pub_param
=
"ipc:///tmp/nrm-downstream-in"
self
.
downstream_pub_socket
.
connect
(
downstream_pub_param
)
logger
.
info
(
"downstream pub socket connected to: %s"
,
downstream_pub_param
)
downstream_url
=
"ipc:///tmp/nrm-downstream-event"
self
.
downstream_event
=
messaging
.
DownstreamEventClient
(
downstream_url
)
self
.
downstream_event
.
wait_connected
()
logger
.
info
(
"downstream pub socket connected to: %s"
,
downstream_url
)
# retrieve our container uuid
self
.
container_uuid
=
os
.
environ
.
get
(
'ARGO_CONTAINER_UUID'
)
...
...
@@ -54,16 +51,14 @@ class PerfWrapper(object):
exit
(
1
)
self
.
app_uuid
=
str
(
uuid
.
uuid4
())
logger
.
info
(
"client uuid: %r"
,
self
.
app_uuid
)
# send an hello to the demon
update
=
{
'type'
:
'application'
,
'event'
:
'start'
,
'container'
:
self
.
container_uuid
,
'uuid'
:
self
.
app_uuid
,
'progress'
:
True
,
'threads'
:
{
'min'
:
1
,
'cur'
:
1
,
'max'
:
1
},
update
=
{
'api'
:
'down_event'
,
'type'
:
'application_start'
,
'container_uuid'
:
self
.
container_uuid
,
'application_uuid'
:
self
.
app_uuid
,
}
self
.
downstream_pub_socket
.
send_json
(
update
)
msg
=
PUB_MSG
[
'application_start'
](
**
update
)
self
.
downstream_event
.
sendmsg
(
msg
)
def
main
(
self
):
parser
=
argparse
.
ArgumentParser
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment