Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
a8b88c0b
Commit
a8b88c0b
authored
Jan 27, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zopewsgi: configure threads count and large_file_threshold with argparse
On Zope4 these settings are no longer in zope.conf
parent
cdfd7bed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
product/ERP5/bin/zopewsgi.py
product/ERP5/bin/zopewsgi.py
+12
-4
product/ERP5Type/tests/ProcessingNodeTestCase.py
product/ERP5Type/tests/ProcessingNodeTestCase.py
+6
-2
No files found.
product/ERP5/bin/zopewsgi.py
View file @
a8b88c0b
...
@@ -84,7 +84,7 @@ class TransLogger(object):
...
@@ -84,7 +84,7 @@ class TransLogger(object):
self
.
logger
.
info
(
message
)
self
.
logger
.
info
(
message
)
def
app_wrapper
(
large_file_threshold
=
10
<<
20
,
webdav_ports
=
()
):
def
app_wrapper
(
large_file_threshold
,
webdav_ports
):
try
:
try
:
from
Products.DeadlockDebugger.dumper
import
dump_threads
,
dump_url
from
Products.DeadlockDebugger.dumper
import
dump_threads
,
dump_url
except
Exception
:
except
Exception
:
...
@@ -163,6 +163,7 @@ def createServer(application, logger, **kw):
...
@@ -163,6 +163,7 @@ def createServer(application, logger, **kw):
return
server
return
server
def
runwsgi
():
def
runwsgi
():
type_registry
=
ZConfig
.
datatypes
.
Registry
()
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--event-log-file'
,
help
=
'Event log file'
)
parser
.
add_argument
(
'--event-log-file'
,
help
=
'Event log file'
)
parser
.
add_argument
(
'--access-log-file'
,
help
=
'Access log file'
)
parser
.
add_argument
(
'--access-log-file'
,
help
=
'Access log file'
)
...
@@ -171,12 +172,19 @@ def runwsgi():
...
@@ -171,12 +172,19 @@ def runwsgi():
parser
.
add_argument
(
'address'
,
help
=
'<ip>:<port>'
)
parser
.
add_argument
(
'address'
,
help
=
'<ip>:<port>'
)
parser
.
add_argument
(
'zope_conf'
,
help
=
'path to zope.conf'
)
parser
.
add_argument
(
'zope_conf'
,
help
=
'path to zope.conf'
)
parser
.
add_argument
(
'--timerserver-interval'
,
help
=
'Interval for timerserver'
,
type
=
float
)
parser
.
add_argument
(
'--timerserver-interval'
,
help
=
'Interval for timerserver'
,
type
=
float
)
parser
.
add_argument
(
'--threads'
,
help
=
'Number of threads'
,
default
=
4
,
type
=
int
)
parser
.
add_argument
(
'--large-file-threshold'
,
help
=
'Requests bigger than this size in bytes get saved into a temporary file '
'instead of being read completely into memory.'
,
type
=
type_registry
.
get
(
'byte-size'
),
default
=
type_registry
.
get
(
'byte-size'
)(
"10MB"
))
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
startup
=
os
.
path
.
dirname
(
Zope2
.
Startup
.
__file__
)
startup
=
os
.
path
.
dirname
(
Zope2
.
Startup
.
__file__
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
startup
,
'wsgischema.xml'
)):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
startup
,
'wsgischema.xml'
)):
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'wsgischema.xml'
))
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'wsgischema.xml'
))
else
:
# BBB
else
:
# BBB
Zope2
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'zopeschema.xml'
))
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'zopeschema.xml'
))
conf
,
_
=
ZConfig
.
loadConfig
(
schema
,
args
.
zope_conf
)
conf
,
_
=
ZConfig
.
loadConfig
(
schema
,
args
.
zope_conf
)
...
@@ -238,11 +246,11 @@ def runwsgi():
...
@@ -238,11 +246,11 @@ def runwsgi():
port
=
int
(
port
)
port
=
int
(
port
)
createServer
(
createServer
(
app_wrapper
(
app_wrapper
(
large_file_threshold
=
getattr
(
conf
,
'large_file_threshold'
,
None
)
,
large_file_threshold
=
args
.
large_file_threshold
,
webdav_ports
=
[
port
]
if
args
.
webdav
else
()),
webdav_ports
=
[
port
]
if
args
.
webdav
else
()),
listen
=
args
.
address
,
listen
=
args
.
address
,
logger
=
access_log_logger
,
logger
=
access_log_logger
,
threads
=
getattr
(
conf
,
'zserver_threads'
,
4
)
,
threads
=
args
.
threads
,
asyncore_use_poll
=
True
,
asyncore_use_poll
=
True
,
# Prevent waitress from adding its own Via and Server response headers.
# Prevent waitress from adding its own Via and Server response headers.
ident
=
None
,
ident
=
None
,
...
...
product/ERP5Type/tests/ProcessingNodeTestCase.py
View file @
a8b88c0b
...
@@ -192,8 +192,12 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
...
@@ -192,8 +192,12 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
logger
=
logging
.
getLogger
(
"access"
)
logger
=
logging
.
getLogger
(
"access"
)
logger
.
addHandler
(
logging
.
FileHandler
(
log
))
logger
.
addHandler
(
logging
.
FileHandler
(
log
))
logger
.
propagate
=
False
logger
.
propagate
=
False
hs
=
createServer
(
app_wrapper
(
webdav_ports
=
webdav_ports
),
hs
=
createServer
(
logger
,
sockets
=
sockets
)
app_wrapper
(
large_file_threshold
=
10
<<
20
,
webdav_ports
=
webdav_ports
),
logger
,
sockets
=
sockets
)
ProcessingNodeTestCase
.
_server_address
=
hs
.
addr
ProcessingNodeTestCase
.
_server_address
=
hs
.
addr
t
=
Thread
(
target
=
hs
.
run
)
t
=
Thread
(
target
=
hs
.
run
)
t
.
setDaemon
(
1
)
t
.
setDaemon
(
1
)
...
...
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