Exemplo n.º 1
0
def main():
    # Main entry point into ARMI
    try:
        if not isConfigured():
            configure(apps.App())
        code = ArmiCLI().run()
        # sys exit interprets None as 0
        sys.exit(code)
    except Exception:
        # Make sure not to catch all BaseExceptions, lest we catch the expected
        # SystemExit exception
        import traceback

        # TODO: change to critical after critical no longer throws an exception.
        print(
            "[CRIT {:03} ] Unhandled exception in __main__ on {}.".format(
                context.MPI_RANK, context.MPI_NODENAME),
            file=sys.__stderr__,
        )
        print(
            "[CRIT {:03} ] Stack trace: {}".format(context.MPI_RANK,
                                                   traceback.format_exc()),
            file=sys.__stderr__,
        )
        if context.MPI_SIZE > 1:
            print(
                "[CRIT {:03} ] killing all MPI tasks from __main__.\n".format(
                    context.MPI_RANK),
                file=sys.__stderr__,
            )
            # cleanTempDirs has @atexit.register so it should be called at the end, but mpi.Abort in main
            # will not allow for @atexit.register or except/finally code to be called so calling here as well
            context.cleanTempDirs()
            # .Abort will not allow for @atexit.register or except/finally code to be called
            context.MPI_COMM.Abort(errorcode=-1)
        raise SystemExit(1)
Exemplo n.º 2
0
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for grid blueprints."""
import io
import unittest

import armi

if not armi.isConfigured():
    armi.configure()
from armi.reactor.blueprints import gridBlueprint
from armi.reactor import systemLayoutInput

LATTICE_BLUEPRINT = """
control:
    geom: hex_corners_up
    symmetry: full
    lattice map: |
       - - - - - - - - - 1 1 1 1 1 1 1 1 1 4
        - - - - - - - - 1 1 1 1 1 1 1 1 1 1 1
         - - - - - - - 1 8 1 1 1 1 1 1 1 1 1 1
          - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1
           - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1
            - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Exemplo n.º 3
0
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for grid blueprints."""
# pylint: disable=wrong-import-position
import io
import os
import unittest

from armi import configure, isConfigured

if not isConfigured():
    configure()
from armi.reactor import systemLayoutInput
from armi.reactor.blueprints import Blueprints
from armi.reactor.blueprints.gridBlueprint import Grids, saveToStream
from armi.reactor.blueprints.tests.test_blockBlueprints import FULL_BP, FULL_BP_GRID

LATTICE_BLUEPRINT = """
control:
    geom: hex_corners_up
    symmetry: full
    lattice map: |
       - - - - - - - - - 1 1 1 1 1 1 1 1 1 4
        - - - - - - - - 1 1 1 1 1 1 1 1 1 1 1
         - - - - - - - 1 8 1 1 1 1 1 1 1 1 1 1
          - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1