# File lib/ruote/dashboard.rb, line 1053
    def worker_state=(state)

      raise RuntimeError.new(
        "'worker_state_enabled' is not set, cannot change state"
      ) unless @context['worker_state_enabled']

      state = state.to_s

      raise ArgumentError.new(
        "#{state.inspect} not in #{WORKER_STATES.inspect}"
      ) unless WORKER_STATES.include?(state)

      doc =
        @context.storage.get('variables', 'worker') ||
        { 'type' => 'variables', '_id' => 'worker', 'state' => 'running' }

      doc['state'] = state

      @context.storage.put(doc) && worker_state=(state)
    end