Пример #1
0
def test_empty_log(db_test_app, plugin_name):

    retrieved = FolderData()
    with retrieved.open('log.lammps', 'w'):
        pass
    with retrieved.open('trajectory.lammpstrj', 'w'):
        pass
    with retrieved.open('_scheduler-stdout.txt', 'w'):
        pass
    with retrieved.open('_scheduler-stderr.txt', 'w'):
        pass

    calc_node = db_test_app.generate_calcjob_node(plugin_name, retrieved)
    parser = db_test_app.get_parser_cls(plugin_name)
    results, calcfunction = parser.parse_from_node(calc_node)

    assert calcfunction.is_finished, calcfunction.exception
    assert calcfunction.is_failed, calcfunction.exit_status
    assert calcfunction.exit_status == calc_node.process_class.exit_codes.ERROR_LOG_PARSING.status
Пример #2
0
def test_run_error(db_test_app, plugin_name):

    retrieved = FolderData()
    with retrieved.open('log.lammps', 'w') as handle:
        handle.write(get_log())
    with retrieved.open('trajectory.lammpstrj', 'w') as handle:
        handle.write(get_traj_force())
    with retrieved.open('_scheduler-stdout.txt', 'w') as handle:
        handle.write(six.ensure_text('ERROR description'))
    with retrieved.open('_scheduler-stderr.txt', 'w'):
        pass

    calc_node = db_test_app.generate_calcjob_node(plugin_name, retrieved)
    parser = db_test_app.get_parser_cls(plugin_name)
    results, calcfunction = parser.parse_from_node(calc_node)

    print(get_calcjob_report(calc_node))

    assert calcfunction.is_finished, calcfunction.exception
    assert calcfunction.is_failed, calcfunction.exit_status
    assert calcfunction.exit_status == calc_node.process_class.exit_codes.ERROR_LAMMPS_RUN.status
Пример #3
0
def test_missing_traj(db_test_app, plugin_name):

    retrieved = FolderData()
    with retrieved.open('log.lammps', 'w'):
        pass

    calc_node = db_test_app.generate_calcjob_node(plugin_name, retrieved)
    parser = db_test_app.get_parser_cls(plugin_name)
    results, calcfunction = parser.parse_from_node(calc_node)

    assert calcfunction.is_finished, calcfunction.exception
    assert calcfunction.is_failed, calcfunction.exit_status
    assert calcfunction.exit_status == calc_node.process_class.exit_codes.ERROR_TRAJ_FILE_MISSING.status