def run
      if block_given?
        update_attribute(:end_time, nil) if ended?
        Krikri::Logger
          .log(:info, "Activity #{agent.constantize}-#{id} is running")
        set_start_time
        begin
          yield agent_instance, rdf_subject
        rescue => e
          Krikri::Logger.log(:error, "Error performing Activity: #{id}\n" \
                                     "#{e.message}\n#{e.backtrace}")
          raise e
        ensure
          set_end_time
          Krikri::Logger
            .log(:info, "Activity #{agent.constantize}-#{id} is done")
        end
      end
    end
def run
      if block_given?
        update_attribute(:end_time, nil) if ended?
        Krikri::Logger
          .log(:info, "Activity #{agent.constantize}-#{id} is running")
        set_start_time
        begin
          yield agent_instance, rdf_subject
        rescue => e
          Krikri::Logger.log(:error, "Error performing Activity: #{id}\n" \
                                     "#{e.message}\n#{e.backtrace}")
          raise e
        ensure
          set_end_time
          Krikri::Logger
            .log(:info, "Activity #{agent.constantize}-#{id} is done")
        end
      end
    end
Runs the block, setting the start and end time of the run. The given block
 is passed an instance of the agent, and a URI representing this Activity.

 Handles logging of activity start/stop and failure states.

 @raise [RuntimeError] re-raises logged errors on Activity failure