How to use the anypytools.abcutils.AnyPyProcess function in anypytools

To help you get started, we’ve selected a few anypytools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_explicit_logfiles_multiple(self, init_simple_model):
        logfile = "test.log"
        macro = [
            ['load "model.main.any"', "operation Main.ArmModelStudy.InverseDynamics"],
            ['load "model.main.any"', "operation Main.ArmModelStudy.InverseDynamics"],
            ['load "model.main.any"', "operation Main.ArmModelStudy.InverseDynamics"],
        ]
        app = AnyPyProcess(silent=True, keep_logfiles=True)
        output = app.start_macro(macro, logfile=logfile)
        assert os.path.isfile("test_0.log")
        assert os.path.isfile("test_1.log")
        assert os.path.isfile("test_2.log")
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_with_gui(self, init_simple_model, default_macro):
        app = AnyPyProcess(silent=True, use_gui=False)
        default_macro[0].append("run")
        output = app.start_macro(default_macro)
        assert not "ERROR" in output[0]
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_start_macro_generator_input(self, init_simple_model, default_macro):
        n_macros = 5

        def generate_macros():
            """Generator that returns macros
            """
            for i in range(n_macros):
                yield default_macro[0]

        app = AnyPyProcess(silent=True)
        macros_gen = generate_macros()
        output = app.start_macro(macros_gen)

        assert len(output) == n_macros
        for result in output:
            assert "ERROR" not in result
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
macro = [
            [
                'load "model.main.any" -def N_STEP="10"',
                "operation Main.ArmModelStudy.InverseDynamics",
                'classoperation Main.ArmModelStudy.Output.MaxMuscleActivity "Dump"',
                'classoperation Main.ArmModel.GlobalRef.t "Dump"',
            ],
            [
                'load "model.main.any" -def N_STEP="20"',
                "operation Main.ArmModelStudy.InverseDynamics",
                'classoperation Main.ArmModelStudy.Output.MaxMuscleActivity "Dump"',
                'classoperation Main.ArmModel.GlobalRef.t "Dump"',
            ],
        ]

        app = AnyPyProcess()
        output = app.start_macro(macro)
        output["GlobalRef.t"]
        output["MaxMuscleActivity"]
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_start_macro(self, init_simple_model, default_macro):
        app = AnyPyProcess(silent=True)

        default_macro[0].extend(
            [
                'classoperation Main.ArmModelStudy.Output.MaxMuscleActivity "Dump"',
                'classoperation Main.ArmModel.GlobalRef.t "Dump"',
            ]
        )

        output = app.start_macro(default_macro)

        assert len(output) == 1
        assert "Main.ArmModelStudy.Output.MaxMuscleActivity" in output[0]
        assert "Main.ArmModel.GlobalRef.t" in output[0]
        assert "ERROR" not in output[0]
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_logfile_persistance(self, init_simple_model, default_macro):
        app = AnyPyProcess(silent=True, keep_logfiles=True)
        output = app.start_macro(default_macro)
        assert os.path.isfile(output[0]["task_logfile"])
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_start_macro_with_task_info(self, init_simple_model, default_macro):
        app = AnyPyProcess(silent=True)

        default_macro[0].extend(
            [
                'classoperation Main.ArmModelStudy.Output.MaxMuscleActivity "Dump"',
                'classoperation Main.ArmModel.GlobalRef.t "Dump"',
            ]
        )

        output = app.start_macro(default_macro)

        assert len(output) == 1
        assert "task_macro_hash" in output[0]
        assert "task_id" in output[0]
        assert "task_work_dir" in output[0]
        assert "task_name" in output[0]
        assert "task_processtime" in output[0]
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_macro_with_erros(self, init_simple_model, default_macro):
        app = AnyPyProcess(
            silent=True, ignore_errors=["Unresolved object"]
        )
        macro = [
            ['load "model.main.any"', "operation Main.ArmModelStudy.InverseDynamics"],
            ['load "model.main.any"', "operation Main.NonExistentOpeation"],
            ['load "not_a_model.any"', "operation Main.ArmModelStudy.InverseDynamics"],
        ]

        output = app.start_macro(macro)

        assert not "ERROR" in output[0]
        assert not "ERROR" in output[1]
        assert "ERROR" in output[2]
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_explicit_logfiles_path(self, init_simple_model, default_macro):
        logfile = pathlib.Path("test.log")
        app = AnyPyProcess(silent=True, keep_logfiles=True)
        output = app.start_macro(default_macro, logfile=logfile)
        assert os.path.isfile(logfile)
github AnyBody-Research-Group / AnyPyTools / tests / test_abcutils.py View on Github external
def test_output_access(self, init_simple_model):
        macro = [
            [
                'load "model.main.any" -def N_STEP="5"',
                "operation Main.ArmModelStudy.InverseDynamics",
                'classoperation Main.ArmModelStudy.Output.MaxMuscleActivity "Dump"',
                'classoperation Main.ArmModel.GlobalRef.t "Dump"',
            ]
        ] * 5

        app = AnyPyProcess()
        output = app.start_macro(macro)
        output["GlobalRef.t"]
        assert (
            output["MaxMuscleActivity"].shape
            == output["Main.ArmModelStudy.Output.MaxMuscleActivity"].shape
        )
        assert isinstance(output[1:3], AnyPyProcessOutputList)