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 9eaeb2e4
authored
Sep 21, 2017
by
BoxuanXu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix fdfs's bug
1 parent
ba8c03a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
20 deletions
src/Drive_Converter.py
src/Drive_Converter.py
View file @
9eaeb2e
...
...
@@ -5,7 +5,8 @@ import pymysql.cursors
import
logging
import
subprocess
from
libpywrap
import
*
#from libpywrap import *
from
stbfclient
import
client
import
requests
...
...
@@ -20,7 +21,7 @@ from mysql_glock import Mysql_lock
import
GProgress
as
GP
import
Queue
import
os
__website__
=
"www.seetatech.com"
__author__
=
"seetatech"
__editor__
=
"xuboxuan"
...
...
@@ -30,7 +31,8 @@ __Date__ = "20170807"
app
=
Flask
(
__name__
)
#initlization fdfs_client
stbf_stcnf
(
"/etc/fdfs/client.conf"
)
#stbf_stcnf("/etc/fdfs/client.conf")
client
.
set_conf
(
"/etc/fdfs/client.conf"
)
download_path
=
"."
...
...
@@ -121,18 +123,26 @@ def get_path_from_db(modelid,seetanet_model):
#download file from fastdfs
if
(
stbf_down
(
params_name_path
,
download_path
)):
logging
.
info
(
"download params file:
%
s success"
%
params_name
)
else
:
err_msg
=
"download file failed"
return
None
,
None
,
err_msg
try
:
client
.
down_file
(
params_name_path
,
download_path
)
if
os
.
path
.
exists
(
params_name
):
logging
.
info
(
"download params file:
%
s success"
%
params_name
)
else
:
raise
Exception
(
"raise exception"
)
except
Exception
,
e
:
err_msg
=
"download file failed"
return
None
,
None
,
err_msg
#download file from fastdfs
if
(
stbf_down
(
graph_name_path
,
download_path
)):
logging
.
info
(
"download params file:
%
s success"
%
graph_name
)
else
:
err_msg
=
"download file failed"
return
None
,
None
,
err_msg
try
:
client
.
down_file
(
graph_name_path
,
download_path
)
if
os
.
path
.
exists
(
graph_name
):
logging
.
info
(
"download params file:
%
s success"
%
graph_name
)
else
:
raise
Exception
(
"raise exception"
)
except
Exception
,
e
:
err_msg
=
"download file failed"
return
None
,
None
,
err_msg
#post return progress
GP
.
set_progress_var
(
10
)
GP
.
Post_return
()
...
...
@@ -149,7 +159,7 @@ def get_path_from_db(modelid,seetanet_model):
def
upload_filetoFastDFS
(
params_name
,
graph_name
,
seetanet_model
):
#upload seetanet file to fastdfs
stmodel_fid
=
stbf_up
(
seetanet_model
)
stmodel_fid
=
client
.
up_file
(
seetanet_model
)
if
(
stmodel_fid
):
logging
.
info
(
"upload seetanet file success,seetanet model_id is
%
s"
%
stmodel_fid
)
else
:
...
...
@@ -298,9 +308,5 @@ def Dirver_Convert():
if
__name__
==
'__main__'
:
try
:
t
.
start
();
app
.
run
(
host
=
'0.0.0.0'
)
finally
:
stbf_rls
()
t
.
start
();
app
.
run
(
host
=
'0.0.0.0'
)
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