Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
007cb0a1
Commit
007cb0a1
authored
Jul 17, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patching file upload to use less memory.
parent
00156cc3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
prontserve.py
prontserve.py
+6
-3
No files found.
prontserve.py
View file @
007cb0a1
...
@@ -94,13 +94,16 @@ class StopHandler(tornado.web.RequestHandler):
...
@@ -94,13 +94,16 @@ class StopHandler(tornado.web.RequestHandler):
prontserve
.
do_stop
()
prontserve
.
do_stop
()
self
.
finish
(
"ACK"
)
self
.
finish
(
"ACK"
)
from
cStringIO
import
StringIO
@
tornado
.
web
.
stream_body
@
tornado
.
web
.
stream_body
class
JobsHandler
(
tornado
.
web
.
RequestHandler
):
class
JobsHandler
(
tornado
.
web
.
RequestHandler
):
def
post
(
self
):
def
post
(
self
):
self
.
read_bytes
=
0
self
.
read_bytes
=
0
self
.
total_bytes
=
self
.
request
.
content_length
self
.
total_bytes
=
self
.
request
.
content_length
self
.
chunks
=
[]
self
.
file_str
=
StringIO
()
print
self
.
request
print
self
.
request
session_uuid
=
self
.
get_argument
(
"session_uuid"
,
None
)
session_uuid
=
self
.
get_argument
(
"session_uuid"
,
None
)
print
"me"
print
"me"
...
@@ -115,7 +118,7 @@ class JobsHandler(tornado.web.RequestHandler):
...
@@ -115,7 +118,7 @@ class JobsHandler(tornado.web.RequestHandler):
def
read_chunks
(
self
,
chunk
=
''
):
def
read_chunks
(
self
,
chunk
=
''
):
self
.
read_bytes
+=
len
(
chunk
)
self
.
read_bytes
+=
len
(
chunk
)
self
.
chunks
.
append
(
chunk
)
self
.
file_str
.
write
(
chunk
)
if
chunk
:
self
.
process_chunk
()
if
chunk
:
self
.
process_chunk
()
chunk_length
=
min
(
100000
,
self
.
request
.
content_length
-
self
.
read_bytes
)
chunk_length
=
min
(
100000
,
self
.
request
.
content_length
-
self
.
read_bytes
)
...
@@ -123,7 +126,7 @@ class JobsHandler(tornado.web.RequestHandler):
...
@@ -123,7 +126,7 @@ class JobsHandler(tornado.web.RequestHandler):
self
.
request
.
connection
.
stream
.
read_bytes
(
self
.
request
.
connection
.
stream
.
read_bytes
(
chunk_length
,
self
.
read_chunks
)
chunk_length
,
self
.
read_chunks
)
else
:
else
:
self
.
request
.
_on_request_body
(
''
.
join
(
self
.
chunks
),
self
.
uploaded
)
self
.
request
.
_on_request_body
(
self
.
file_str
.
getvalue
(
),
self
.
uploaded
)
def
process_chunk
(
self
):
def
process_chunk
(
self
):
print
self
.
get_argument
(
"session_uuid"
,
None
)
print
self
.
get_argument
(
"session_uuid"
,
None
)
...
...
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