Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
BoxuanXu
/
FlaskDriverMXNet2SeetaNet
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1c6fd829
authored
Sep 02, 2017
by
BoxuanXu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit err msg
1 parent
17b5ba03
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
23 deletions
src/Drive_Converter.py
src/converter.py
src/Drive_Converter.py
View file @
1c6fd82
...
...
@@ -40,7 +40,7 @@ output_layer = ""
pool_id
=
""
err_msg
=
""
post_url
=
"http://192.168l.1.1
70
:1234/API"
post_url
=
"http://192.168l.1.1
27
:1234/API"
#post_url = "http://192.168.1.244:5000/result"
#init post info queue
Info_Queue
=
Queue
.
Queue
()
...
...
@@ -52,7 +52,7 @@ logging.basicConfig(
)
db_atlas
=
pymysql
.
connect
(
"192.168.1.1
5"
,
"defaultUser"
,
"magician"
,
"seetaAtlas"
)
db_atlas
=
pymysql
.
connect
(
"192.168.1.1
27"
,
"defaultUser"
,
"magician"
,
"seetaAtlas"
,
3306
)
curl_atlas
=
db_atlas
.
cursor
()
curl_atlas_exe
=
db_atlas
.
cursor
()
...
...
@@ -70,10 +70,15 @@ def get_path_from_db(modelid,seetanet_model):
else
:
path_name
=
str
(
result_atlas
[
0
])
if
path_name
.
find
(
"|"
)
==
-
1
:
if
path_name
.
find
(
"::"
)
==
-
1
:
logging
.
info
(
'get wrong parameters!'
)
return
None
,
None
else
:
path_list
=
path_name
.
split
(
"::"
)
else
:
path_list
=
path_name
.
split
(
"|"
)
if
len
(
path_list
)
!=
2
:
logging
.
info
(
'get wrong parameters!'
)
else
:
...
...
@@ -110,12 +115,13 @@ def get_path_from_db(modelid,seetanet_model):
else
:
return
None
,
None
GP
.
set_progress_var
(
20
)
#post return progress
GP
.
set_progress_var
(
10
)
GP
.
Post_return
()
#Driver converter model by params and model graph
result
=
Run_Converter
(
params_name
,
graph_name
,
seetanet_model
)
if
result
is
Non
e
:
if
result
is
tru
e
:
return
None
,
None
#Run_Converter("model-0015.params","model-symbol.json",seetanet_model)
...
...
@@ -138,9 +144,9 @@ def get_info_from_queue(arg):
if
not
Info_Queue
.
empty
():
Info
=
Info_Queue
.
get
()
logging
.
info
(
"Begin Convert Info is : modelid =
%
s, output_layer =
%
s ,
Post_Host =
%
s"
%
(
Info
[
"modelid"
],
Info
[
"output_layer"
],
Info
[
"post_url
"
]))
logging
.
info
(
"Begin Convert Info is : modelid =
%
s, output_layer =
%
s ,
pool_id =
%
s"
%
(
Info
[
"modelid"
],
Info
[
"output_layer"
],
Info
[
"pool_id
"
]))
return_flag
=
"
TRUE
"
return_flag
=
"
updateProgress
"
modelid
=
Info
[
"modelid"
]
output_layer
=
Info
[
"output_layer"
]
...
...
@@ -153,8 +159,8 @@ def get_info_from_queue(arg):
GP
.
set_post_type_var
(
return_flag
)
try
:
#post return progress
GP
.
set_progress_var
(
10
)
GP
.
Post_return
()
#
GP.set_progress_var(10)
#
GP.Post_return()
seetanet_model
=
"model_"
+
str
(
modelid
)
+
".data"
...
...
@@ -164,14 +170,14 @@ def get_info_from_queue(arg):
if
params_name
is
None
or
graph_name
is
None
:
logging
.
info
(
"get wrong params file"
)
err_msg
=
"get wrong params file"
return_flag
=
"
FALSE
"
return_flag
=
"
error
"
else
:
stmodel_fid
=
upload_filetoFastDFS
(
params_name
,
graph_name
,
seetanet_model
)
if
stmodel_fid
is
None
:
logging
.
info
(
"upload filed"
)
err_msg
=
"upload filed"
return_flag
=
"
FALSE
"
return_flag
=
"
error
"
else
:
#remove params file and graph file
...
...
@@ -183,14 +189,14 @@ def get_info_from_queue(arg):
logging
.
info
(
"shell command error!"
)
err_msg
=
"shell command error!"
return_flag
=
"
FALSE
"
return_flag
=
"
error
"
logging
.
info
(
"convert successfully!"
)
logging
.
info
(
"Begin Run JenkIn!"
)
GP
.
set_progress_var
(
90
)
GP
.
Post_return
()
#
GP.set_progress_var(90)
#
GP.Post_return()
J
=
Jenkins
(
host
,
username
=
'shenyizhong'
,
password
=
'shenyizhong'
)
job
=
J
[
'SeetaNetLite-pro'
]
...
...
@@ -203,19 +209,20 @@ def get_info_from_queue(arg):
logging
.
info
(
'Finish JenkIn,build #: {} ,status : {}'
.
format
(
b
.
get_number
(),
b
.
get_status
()))
if
b
.
get_status
()
==
"SUCCESS"
:
return_flag
=
"
SUCCESS
"
return_flag
=
"
finish
"
else
:
err_msg
=
"JenkIn
Wrong
False"
return_flag
=
"
FALSE
"
err_msg
=
"JenkIn
's Engine
False"
return_flag
=
"
error
"
except
Exception
,
e
:
#GP.set_err_msg_var(repr(e))
err_msg
=
repr
(
e
)
return_flag
=
"FALSE"
#err_msg = repr(e)
err_msg
=
"unknown error from model convert!"
return_flag
=
"error"
finally
:
GP
.
set_post_type_var
(
return_flag
)
GP
.
set_err_msg_var
(
err_msg
)
if
return_flag
==
"
SUCCESS
"
:
if
return_flag
==
"
finish
"
:
GP
.
set_progress_var
(
100
)
#post_return = { "posttype": return_flag, "progress" : 100, "pool_id": pool_id, "err_msg":err_msg }
else
:
...
...
@@ -230,15 +237,16 @@ t = threading.Thread(target=get_info_from_queue,args=(1,))
@app.route
(
'/convert'
,
methods
=
[
'POST'
])
def
Dirver_Convert
():
#get parameter modelid from post stream
return_flag
=
"
TRUE
"
return_flag
=
"
false
"
try
:
modelid
=
request
.
form
[
'modelid'
]
output_layer
=
request
.
form
[
'output_layer'
]
pool_id
=
request
.
form
[
'pool_id'
]
if
modelid
==
''
or
modelid
==
None
or
output_layer
==
''
or
output_layer
==
None
or
pool_id
==
''
or
output_layer
==
None
:
logging
.
info
(
"New Post Connect: get wrong parameter!"
)
return_flag
=
"
FALSE
"
return_flag
=
"
false
"
else
:
return_flag
=
"true"
logging
.
info
(
"New Post Connect: modelid :
%
s , post_url :
%
s, Queue size :
%
d"
%
(
modelid
,
post_url
,(
Info_Queue
.
qsize
()
+
1
)))
Post_Info
=
{
"modelid"
:
modelid
,
"output_layer"
:
output_layer
,
"pool_id"
:
pool_id
}
...
...
src/converter.py
View file @
1c6fd82
...
...
@@ -374,8 +374,8 @@ class Converter(object):
fo
.
write
(
ss
)
#post return progress
if
(
i
>
(
flag
*
(
self
.
__graph
.
idx_count
/
6
))):
GP
.
set_progress_var
(
flag
*
10
+
2
0
)
if
(
i
>
(
flag
*
(
self
.
__graph
.
idx_count
/
8
))):
GP
.
set_progress_var
(
flag
*
10
+
1
0
)
GP
.
Post_return
()
flag
=
flag
+
1
# 加最后一个标记层
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment