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
Labels
Merge Requests
140
Merge Requests
140
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
21145521
Commit
21145521
authored
Jan 27, 2023
by
Jérome Perrin
Committed by
Aurel
Feb 01, 2023
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
c01de1ad
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 @
21145521
...
@@ -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 @
21145521
...
@@ -183,8 +183,12 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
...
@@ -183,8 +183,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