Commit 856e96e4 authored by David Hendriks's avatar David Hendriks
Browse files

trying to fix the system errors

parent cd104946
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -2211,5 +2211,35 @@ class Population:
    #     Function to join the result dictionaries
    #     """

    def _check_binary_c_error(self, binary_c_output, argstring):
        """
        Function to check whether binary_c throws an error and handle accordingly. 
    
        TODO: build mechanism to stop the run if too many failing systems found
        """

        # print(binary_c_output)
        # print(argstring)

        if binary_c_output.startswith("SYSTEM_ERROR"):
            # print('error found')

            # Write arglines to file
            with open(os.path.join(self.grid_options['tmp_dir'], 'failed_systems.txt'), 'a+') as f:
                f.write(argstring)

            try:
                error_code = int(binary_c_output.splitlines()[0].split("with error code")[-1].split(":")[0].strip())

                print(int(error_code))
                # print(binary_c_output.splitlines()[0].split("with error code")[-1].split(":")[0])
                if not error_code in self.grid_options['failing_systems_error_codes']:
                    self.grid_options['failing_systems_error_codes'].apppend(error_code)
            except ValueError:
                print("failed to extract the error-code")

            self.grid_options['failed_count'] += 1
            self.grid_options['']


################################################################################################
+1 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ grid_options_defaults_dict = {
    "error": 0,  # error?
    "failed_count": 0,  # amt of failed systems
    "failed_prob": 0,  # Summed probability of failed systems
    "failed_systems_error_codes": [],
    "id": 0,  # Random id of this grid/population run,
    "modulo": 1,  # run modulo n of the grid.
    ## Grid type evolution