Skip to content

Commit

Permalink
Merge branch '1.2_maintenance' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Jun 2, 2023
2 parents 2d0d58c + dd40cb6 commit adf9398
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ Improvements
------------

- EditScope : Hid the `BoxIn.name` and `BoxOut.name` plugs from the NodeEditor, since it is not editable and the name is _always_ `in` or `out` respectively.
- Limits : Increased soft file handle limit (`RLIMIT_NOFILE`) to match the hard limit (Linux only).
- SceneReader : Increased the default limit for the number of open files to 2000 (or 25% of the file handle limit, whichever is lowest).

Fixes
-----
Expand Down
11 changes: 10 additions & 1 deletion bin/__gaffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,17 @@
warnings.simplefilter( "default", DeprecationWarning )

import IECore
from Gaffer._Gaffer import _nameProcess

# Increase the soft limit for file handles as high as we can - we need everything we can get for
# opening models, textures etc.
if os.name != "nt" :
import resource
softFileLimit, hardFileLimit = resource.getrlimit( resource.RLIMIT_NOFILE )
if softFileLimit < hardFileLimit :
resource.setrlimit( resource.RLIMIT_NOFILE, ( hardFileLimit, hardFileLimit ) )
IECore.msg( IECore.Msg.Level.Info, "Gaffer", "Increased file handle limit to {}".format( hardFileLimit ) )

from Gaffer._Gaffer import _nameProcess
_nameProcess()

helpText = """Usage :
Expand Down
53 changes: 53 additions & 0 deletions startup/GafferScene/sharedSceneInterfaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
##########################################################################
#
# Copyright (c) 2023, Cinesite VFX Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided with
# the distribution.
#
# * Neither the name of John Haddon nor the names of
# any other contributors to this software may be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
##########################################################################

import os

import IECoreScene

# Cortex default limit is 200, which is not sufficient for many real production
# use cases, and the cost of re-opening large USD assemblies is too high to
# want to do it more than once.

maxScenes = 2000
if os.name != "nt" :
import resource
maxScenes = max(
200,
min( maxScenes, resource.getrlimit( resource.RLIMIT_NOFILE )[0] // 4 )
)

IECoreScene.SharedSceneInterfaces.setMaxScenes( maxScenes )

0 comments on commit adf9398

Please sign in to comment.