예제 #1
0
파일: views.py 프로젝트: NAVADMC/ADSM
def validate_scenario(request):
    simulation = subprocess.Popen(adsm_executable_command() + ['--dry-run'],
                                  shell=(platform.system() != 'Darwin'),
                                  stdout=subprocess.PIPE,
                                  stderr=subprocess.PIPE)
    stdout, stderr = simulation.communicate()  # still running while we work on python validation
    
    simulation.wait()  # simulation will process db then exit
    print("C Engine Exit Code:", simulation.returncode)
    context = {'dry_run_passed': simulation.returncode == 0 and not stderr,
               'sim_output': stdout.decode() + stderr.decode(),
               'whole_scenario_warnings': whole_scenario_validation(),
               'base_page': 'ScenarioCreator/Validation.html'}
    return render(request, 'ScenarioCreator/MainPanel.html', context)