def calc_finished(self):
        '''
        Check if the lockfile is in the calculation directory.
        It is removed by the script at the end regardless of the
        success of the calculation. This is totally tied to
        implementation and you need to implement your own scheme!
        '''
        #print_stack(limit=5)
        if not self.calc_running :
            #print('Calc running:',self.calc_running)
            return True
        else:
            # The calc is marked as running check if this is still true
            # We do it by external scripts. You need to write these
            # scripts for your own system.
            # See examples/scripts directory for examples.
            with work_dir(self.working_dir) :
                o=check_output(['check-job'])
            #print('Status',o)
            if o[0] in b'R' :
                # Still running - we do nothing to preserve the state
                return False
            else :
                # The job is not running maybe it finished maybe crashed
                # We hope for the best at this point ad pass to the
                # Standard update function
                return True
Check if the lockfile is in the calculation directory.
        It is removed by the script at the end regardless of the
        success of the calculation. This is totally tied to
        implementation and you need to implement your own scheme!