Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
65704e57
Commit
65704e57
authored
5 years ago
by
Karim Ahmed
Browse files
Options
Downloads
Patches
Plain Diff
timeout and parseargs help msgs
parent
af3bbbc5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
reportservice/automatic_run.py
+13
-5
13 additions, 5 deletions
reportservice/automatic_run.py
reportservice/manual_run.py
+16
-6
16 additions, 6 deletions
reportservice/manual_run.py
reportservice/report_service.py
+9
-3
9 additions, 3 deletions
reportservice/report_service.py
with
38 additions
and
14 deletions
reportservice/automatic_run.py
+
13
−
5
View file @
65704e57
...
...
@@ -9,7 +9,7 @@ import yaml
import
zmq
import
zmq.asyncio
async
def
auto_run
(
cfg
):
async
def
auto_run
(
cfg
,
timeout
=
3000
):
"""
Run the report service automatically depending on the scheduled times
in the run_time list, read from the config yaml file (report_conf.yaml)
...
...
@@ -38,6 +38,8 @@ async def auto_run(cfg):
con
=
zmq
.
asyncio
.
Context
()
sock
=
con
.
socket
(
zmq
.
REQ
)
port
=
cfg
[
'
GLOBAL
'
][
'
server-port
'
]
sock
.
SNDTIMEO
=
timeout
sock
.
RCVTIMEO
=
timeout
sock
.
connect
(
port
)
await
sock
.
send_pyobj
([
'
all
'
])
msg
=
await
sock
.
recv_pyobj
()
...
...
@@ -51,14 +53,20 @@ async def auto_run(cfg):
# check every 10mins, if there is
# a need for an automatic-run.
await
asyncio
.
sleep
(
6
00
)
await
asyncio
.
sleep
(
30
00
)
arg_parser
=
argparse
.
ArgumentParser
(
description
=
'
Automatic Launch
'
)
arg_parser
.
add_argument
(
'
--config-file
'
,
type
=
str
,
default
=
'
./report_conf.yaml
'
)
arg_parser
.
add_argument
(
'
--log-file
'
,
type
=
str
,
default
=
'
./report.log
'
)
arg_parser
.
add_argument
(
'
--config-file
'
,
type
=
str
,
default
=
'
./report_conf.yaml
'
,
help
=
'
config file path with reportservice port.
'
'
Default=./report_conf.yaml
'
)
arg_parser
.
add_argument
(
'
--log-file
'
,
type
=
str
,
default
=
'
./report.log
'
,
help
=
'
The report log file path. Default=./report.log
'
)
arg_parser
.
add_argument
(
'
--logging
'
,
type
=
str
,
default
=
"
INFO
"
,
choices
=
[
'
INFO
'
,
'
DEBUG
'
,
'
ERROR
'
])
help
=
'
logging modes: INFO, DEBUG or ERROR.
'
'
Default=INFO
'
,
choices
=
[
'
INFO
'
,
'
DEBUG
'
,
'
ERROR
'
])
if
__name__
==
"
__main__
"
:
args
=
vars
(
arg_parser
.
parse_args
())
...
...
This diff is collapsed.
Click to expand it.
reportservice/manual_run.py
+
16
−
6
View file @
65704e57
...
...
@@ -33,13 +33,23 @@ def manual_run(request, cfg):
logging
.
info
(
'
{} Manual Run
'
.
format
(
msg
))
arg_parser
=
argparse
.
ArgumentParser
(
description
=
'
Manual Launch
'
)
arg_parser
.
add_argument
(
'
--instrument
'
,
default
=
[
'
all
'
],
nargs
=
'
+
'
)
arg_parser
.
add_argument
(
'
--testing
'
,
dest
=
'
testing
'
,
action
=
'
store_true
'
)
arg_parser
.
add_argument
(
'
--instrument
'
,
default
=
[
'
all
'
],
nargs
=
'
+
'
,
help
=
'
select the requested instruments.
'
'
Default=all
'
)
arg_parser
.
add_argument
(
'
--testing
'
,
dest
=
'
testing
'
,
action
=
'
store_true
'
,
help
=
'
required for testing with different
'
'
config files
'
)
arg_parser
.
set_defaults
(
testing
=
False
)
arg_parser
.
add_argument
(
'
--config-file
'
,
type
=
str
,
default
=
'
./report_conf.yaml
'
)
arg_parser
.
add_argument
(
'
--log-file
'
,
type
=
str
,
default
=
'
./report.log
'
)
arg_parser
.
add_argument
(
'
--logging
'
,
type
=
str
,
default
=
"
INFO
"
,
choices
=
[
'
INFO
'
,
'
DEBUG
'
,
'
ERROR
'
])
arg_parser
.
add_argument
(
'
--config-file
'
,
type
=
str
,
default
=
'
./report_conf.yaml
'
,
help
=
'
config file path with reportservice port.
'
'
Default=./report_conf.yaml
'
)
arg_parser
.
add_argument
(
'
--log-file
'
,
type
=
str
,
default
=
'
./report.log
'
,
help
=
'
The report log file path. Default=./report.log
'
)
arg_parser
.
add_argument
(
'
--logging
'
,
type
=
str
,
default
=
"
INFO
"
,
help
=
'
logging modes: INFO, DEBUG or ERROR.
'
'
Default=INFO
'
,
choices
=
[
'
INFO
'
,
'
DEBUG
'
,
'
ERROR
'
])
if
__name__
==
"
__main__
"
:
args
=
vars
(
arg_parser
.
parse_args
())
...
...
This diff is collapsed.
Click to expand it.
reportservice/report_service.py
+
9
−
3
View file @
65704e57
...
...
@@ -269,10 +269,16 @@ async def server_runner(config):
break
arg_parser
=
argparse
.
ArgumentParser
(
description
=
'
Start the report service
'
)
arg_parser
.
add_argument
(
'
--config-file
'
,
type
=
str
,
default
=
'
./report_conf.yaml
'
)
arg_parser
.
add_argument
(
'
--log-file
'
,
type
=
str
,
default
=
'
./report.log
'
)
arg_parser
.
add_argument
(
'
--config-file
'
,
type
=
str
,
default
=
'
./report_conf.yaml
'
,
help
=
'
config file path with reportservice port.
'
'
Default=./report_conf.yaml
'
)
arg_parser
.
add_argument
(
'
--log-file
'
,
type
=
str
,
default
=
'
./report.log
'
,
help
=
'
The report log file path. Default=./report.log
'
)
arg_parser
.
add_argument
(
'
--logging
'
,
type
=
str
,
default
=
"
INFO
"
,
choices
=
[
'
INFO
'
,
'
DEBUG
'
,
'
ERROR
'
])
help
=
'
logging modes: INFO, DEBUG or ERROR.
'
'
Default=INFO
'
,
choices
=
[
'
INFO
'
,
'
DEBUG
'
,
'
ERROR
'
])
if
__name__
==
"
__main__
"
:
args
=
vars
(
arg_parser
.
parse_args
())
...
...
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