code: def lock_record(self, record_id):
      # workaround for several concurrent workers on cloud:
      #  create history record before start of task
      record = db.Jobs.query.get(record_id)
  
      try:
          history_record = db.JobsHistory(
              job_id=record.id,
              start_at=record.next_run_at,
              company_id=record.company_id,
          )
  
          db.session.add(history_record)
          db.session.commit()
  
          return history_record.id
  
      except (KeyboardInterrupt, SystemExit):
          raise
      except Exception:
          db.session.rollback()
  
          # check if it is an old lock
          history_record = db.JobsHistory.query.filter_by(
              job_id=record.id,
              start_at=record.next_run_at,
              company_id=record.company_id,
          ).first()
          if (
              history_record.updated_at
              < dt.datetime.now() - dt.timedelta(seconds=30)
          ):
              db.session.delete(history_record)
              db.session.commit()
  
      return None
  
imports: import re
  import datetime
  from dateutil.relativedelta import relativedelta
  import sqlalchemy
  from mindsdb_sql import parse_sql, ParsingException
  from mindsdb.utilities.context import context
  from mindsdb.utilities.exception import EntityNotExistsError, EntityExistsError
  from mindsdb.interfaces.storage import db
  from mindsdb.interfaces.database.projects import ProjectController
  from mindsdb.interfaces.query_context.context_controller import query_context_controller
  from mindsdb.utilities import log
label_desc: Use image node_id 4 for calling the JobsExecutor obj's underlying member method code with example usage: obj.lock_record(record_id) and returns: None, history_record