<commit_before>from uuid import uuid4


class PrimaryDiagnostic(object):
    def __init__(self, config):
        """
            Setup class attributes
        """
        self.inputs = {
            'coupled_diag_path': '',
            'test_casename': '',
            'test_native_res': '',
            'test_archive_dir': '',
            'test_begin_yr_climo': '',
            'test_end_yr_climo': '',
            'test_begin_yr_ts': '',
            'test_end_yr_ts': '',
            'ref_case': '',
            'ref_archive_dir': '',
        }
        self.outputs = {}
        self.uuid = uuid4().hex
        print "init"

    def prevalidate(self, config):
        """
            Iterate over given config dictionary making sure all the inputs are set
            and rejecting any inputs that arent in the input dict
        """
        print 'prevalidate'

    def postvalidate(self):
        """
            Check that what the job was supposed to do actually happened
        """
        print 'postvalidate'

    def execute(self):
        """
            Perform the actual work
        """
        print 'execute'<commit_msg>Begins fleshing out the primary diags job<commit_after>import os

from uuid import uuid4
from util import render
from pprint import pformat

class PrimaryDiagnostic(object):
    def __init__(self, config):
        """
        Setup class attributes
        """
        self.inputs = {
            'coupled_project_dir': '',
            'test_casename': '',
            'test_native_res': '',
            'test_archive_dir': '',
            'test_begin_yr_climo': '',
            'test_end_yr_climo': '',
            'test_begin_yr_ts': '',
            'test_end_yr_ts': '',
            'ref_case': '',
            'ref_archive_dir': '',
            'mpas_meshfile': '',
            'mpas_remapfile': '',
            'pop_remapfile': '',
            'remap_files_dir': '',
            'GPCP_regrid_wgt_file': '',
            'CERES_EBAF_regrid_wgt_file': '',
            'ERS_regrid_wgt_file': '',
            'coupled_home_directory': '',
            'coupled_template_path': '',
            'rendered_output_path': '',
            'obs_ocndir': '',
            'obs_seaicedir': '',
            'obs_sstdir': '',
            'obs_iceareaNH': '',
            'obs_iceareaSH': '',
            'obs_icevolNH': '',
            'obs_icevolSH': ''
        }
        self.config = {}
        self.status = 'unvalidated'
        self.type = 'primary_diag'
        self.outputs = {}
        self.uuid = uuid4().hex
        self.job_id = 0
        self.depends_on = []
        self.prevalidate(config)
        print "init"


    def __str__(self):
        return pformat({
            'type': self.type,
            'config': self.config,
            'status': self.status,
            'depends_on': self.depends_on,
            'uuid': self.uuid,
            'job_id': self.job_id
        }, indent=4)

    def prevalidate(self, config):
        """
        Iterate over given config dictionary making sure all the inputs are set
        and rejecting any inputs that arent in the input dict
        """
        self.config = config
        self.depends_on = config.get('depends_on')
        self.status = 'valid'

    def postvalidate(self):
        """
        Check that what the job was supposed to do actually happened
        """
        print 'postvalidate'

    def execute(self):
        """
        Perform the actual work
        """
        render(
            variables=self.config,
            input_path=self.config.get('coupled_template_path'),
            output_path=self.config.get('rendered_output_path'),
            delimiter='%%')
        return
        #os.chdir(self.config.get('coupled_home_directory'))

{'fraction_non_alphanumeric': 0.12101063829787234, 'fraction_numerical': 0.0015957446808510637, 'mean_word_length': 1.6941260744985673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5363340', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1053, 'n_words': 223}