def update_endtime(jid, time):
    '''
    Update (or store) the end time for a given job

    Endtime is stored as a plain text string
    '''
    jid_dir = _jid_dir(jid)
    try:
        if not os.path.exists(jid_dir):
            os.makedirs(jid_dir)
        with salt.utils.fopen(os.path.join(jid_dir, ENDTIME), 'w') as etfile:
            etfile.write(time)
    except __HOLE__ as exc:
        log.warning('Could not write job invocation cache file: {0}'.format(exc))
dataset/ETHPy150Open saltstack/salt/salt/returners/local_cache.py/update_endtime