Load the ruby code for the actors

 === Return
 true:: Always return true
15705
def load_actors
      # Load agent's configured actors
      actors = (@options[:actors] || []).clone
      Log.info("[setup] Agent #{@identity} with actors #{actors.inspect}")
      actors_dirs = AgentConfig.actors_dirs
      actors_dirs.each do |dir|
        Dir["#{dir}/*.rb"].each do |file|
          actor = File.basename(file, ".rb")
          next if actors && !actors.include?(actor)
          Log.info("[setup] Loading actor #{file}")
          require file
          actors.delete(actor)
        end
      end
      ErrorTracker.log(self, "Actors #{actors.inspect} not found in #{actors_dirs.inspect}") unless actors.empty?

      # Perform agent-specific initialization including actor creation and registration
      if (init_file = AgentConfig.init_file)
        Log.info("[setup] Initializing agent from #{init_file}")
        instance_eval(File.read(init_file), init_file)
      else
        ErrorTracker.log(self, "No agent init.rb file found in init directory of #{AgentConfig.root_dir.inspect}")
      end
      true
    end
1302062
function loadScript(redis, script_name, script, callback) {
  redis.multi()
    .script('load', script)
    .exec(function (err, sha1) {
      if (err) {
        return callback(err);
      }
      shas[script_name] = sha1 && sha1.length && sha1[0];
      callback(null, sha1);
    });
}
1223113
def load_scripts!
      scripts_dir = File.expand_path @config['blur']['scripts_dir']
      script_file_paths = Dir.glob File.join scripts_dir, '*.rb'

      # Sort the script file paths by file name so they load by alphabetical
      # order.
      #
      # This will make it possible to create a script called '10_database.rb'
      # which will be loaded before '20_settings.rb' and non-numeric prefixes
      # will be loaded after that.
      script_file_paths = script_file_paths.sort do |a, b|
        File.basename(a) <=> File.basename(b)
      end

      script_file_paths.each { |script_path| load_script_file script_path }

      initialize_superscripts

      emit :scripts_loaded
    end
1290167
def _load_lua_scripts(self):
        """"""
        # load lua scripts
        lua_script_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            'scripts/lua'
        )
        with open(os.path.join(
                lua_script_path,
                'enqueue.lua'), 'r') as enqueue_file:
            self._lua_enqueue_script = enqueue_file.read()
            self._lua_enqueue = self._r.register_script(
                self._lua_enqueue_script)

        with open(os.path.join(
                lua_script_path,
                'dequeue.lua'), 'r') as dequeue_file:
            self._lua_dequeue_script = dequeue_file.read()
            self._lua_dequeue = self._r.register_script(
                self._lua_dequeue_script)

        with open(os.path.join(
                lua_script_path,
                'finish.lua'), 'r') as finish_file:
            self._lua_finish_script = finish_file.read()
            self._lua_finish = self._r.register_script(self._lua_finish_script)

        with open(os.path.join(
                lua_script_path,
                'interval.lua'), 'r') as interval_file:
            self._lua_interval_script = interval_file.read()
            self._lua_interval = self._r.register_script(
                self._lua_interval_script)

        with open(os.path.join(
                lua_script_path,
                'requeue.lua'), 'r') as requeue_file:
            self._lua_requeue_script = requeue_file.read()
            self._lua_requeue = self._r.register_script(
                self._lua_requeue_script)

        with open(os.path.join(
                lua_script_path,
                'metrics.lua'), 'r') as metrics_file:
            self._lua_metrics_script = metrics_file.read()
            self._lua_metrics = self._r.register_script(
                self._lua_metrics_script)
1170048
def load(self, name, code):
        """"""

        source = "\n".join(code)
        self._objects[name] = source
296329
def url_object(code)
      @code_bucket.get(code, :r => 1)
    rescue Riak::FailedRequest => err
      raise unless err.not_found?
    end
992516
def rake_require(file_name, paths=$LOAD_PATH, loaded=$")
      fn = file_name + ".rake"
      return false if loaded.include?(fn)
      paths.each do |path|
        full_path = File.join(path, fn)
        if File.exist?(full_path)
          Rake.load_rakefile(full_path)
          loaded << fn
          return true
        end
      end
      fail LoadError, "Can't find #{file_name}"
    end
660633
def load_api_keys
      fallback = load_file(credentials_path) if File.exists?(credentials_path)

      @api_keys = Gem::Keychain::ApiKeys.new(fallback: fallback)
    end
782932
def load fixture
      raise LoadingFixtureIllegal, "A check has already been made, loading a different fixture is illegal" if @checked
      
      Fast.dir("#{fixtures_path}/#{fixture}").files.to.symbols.each do |file|
        @data ||= {}
        @data[file] = SymbolMatrix.new "#{fixtures_path}/#{fixture}/#{file}.yaml"
      end
    end
429271
def load_all_objects
            return if loaded? or @parser.nil?

            @revisions.each do |revision|
                if revision.xreftable?
                    xrefs = revision.xreftable
                elsif revision.xrefstm?
                    xrefs = revision.xrefstm
                else
                    next
                end

                xrefs.each_with_number do |xref, no|
                    self.get_object(no) unless xref.free?
                end
            end

            loaded!
        end
694447
def ruby_code?(str)
      str = str.to_s
      return false if str.empty?

      checker = FoodCritic::ErrorChecker.new(str)
      checker.parse
      !checker.error?
    end
498686
def load!(path)
      settings = YAML.safe_load(ERB.new(File.new(path).read).result)['api']
      from_hash(settings) if settings.is_a? Hash
    end
918001
def load_lib_folder
      return false if Adhearsion.config.core.lib.nil?

      lib_folder = [Adhearsion.config.core.root, Adhearsion.config.core.lib].join '/'
      return false unless File.directory? lib_folder

      $LOAD_PATH.unshift lib_folder

      Dir.chdir lib_folder do
        rbfiles = File.join "**", "*.rb"
        Dir.glob(rbfiles).each do |file|
          require "#{lib_folder}/#{file}"
        end
      end
      true
    end
149114
def _load_actor_class_from_gcs(self, driver_id, function_descriptor):
        """"""
        key = (b"ActorClass:" + driver_id.binary() + b":" +
               function_descriptor.function_id.binary())
        # Wait for the actor class key to have been imported by the
        # import thread. TODO(rkn): It shouldn't be possible to end
        # up in an infinite loop here, but we should push an error to
        # the driver if too much time is spent here.
        while key not in self.imported_actor_classes:
            time.sleep(0.001)

        # Fetch raw data from GCS.
        (driver_id_str, class_name, module, pickled_class,
         actor_method_names) = self._worker.redis_client.hmget(
             key, [
                 "driver_id", "class_name", "module", "class",
                 "actor_method_names"
             ])

        class_name = ensure_str(class_name)
        module_name = ensure_str(module)
        driver_id = ray.DriverID(driver_id_str)
        actor_method_names = json.loads(ensure_str(actor_method_names))

        actor_class = None
        try:
            with self.lock:
                actor_class = pickle.loads(pickled_class)
        except Exception:
            logger.exception(
                "Failed to load actor class %s.".format(class_name))
            # The actor class failed to be unpickled, create a fake actor
            # class instead (just to produce error messages and to prevent
            # the driver from hanging).
            actor_class = self._create_fake_actor_class(
                class_name, actor_method_names)
            # If an exception was thrown when the actor was imported, we record
            # the traceback and notify the scheduler of the failure.
            traceback_str = ray.utils.format_error_message(
                traceback.format_exc())
            # Log the error message.
            push_error_to_driver(
                self._worker, ray_constants.REGISTER_ACTOR_PUSH_ERROR,
                "Failed to unpickle actor class '{}' for actor ID {}. "
                "Traceback:\n{}".format(class_name,
                                        self._worker.actor_id.hex(),
                                        traceback_str), driver_id)
            # TODO(rkn): In the future, it might make sense to have the worker
            # exit here. However, currently that would lead to hanging if
            # someone calls ray.get on a method invoked on the actor.

        # The below line is necessary. Because in the driver process,
        # if the function is defined in the file where the python script
        # was started from, its module is `__main__`.
        # However in the worker process, the `__main__` module is a
        # different module, which is `default_worker.py`
        actor_class.__module__ = module_name
        return actor_class
934390
def check_agent(options, cfg)
      identity = options[:identity]
      agent_type = options[:agent_type]
      type = AgentIdentity.parse(identity).agent_type if identity
      fail("Agent type #{agent_type.inspect} and identity #{identity.inspect} are inconsistent") if agent_type != type
      fail("Cannot find agent init.rb file in init directory of #{AgentConfig.root_dir.inspect}") unless AgentConfig.init_file

      actors = cfg[:actors]
      fail('Agent configuration is missing actors') unless actors && actors.respond_to?(:each)
      actors_dirs = AgentConfig.actors_dirs
      actors.each do |a|
        found = false
        actors_dirs.each { |d| break if (found = File.exist?(File.normalize_path(File.join(d, "#{a}.rb")))) }
        fail("Cannot find source for actor #{a.inspect} in #{actors_dirs.inspect}") unless found
      end
      true
    end
876243
def parse_actors_array(hash)
      actorsArray = Array.new
       hash["cast"].each do |actor|
         actorsArray.push(Actor.new(actor))
       end
       return actorsArray
    end
926276
def load! parse_client=Parse::Client.default
      unless @objects
        pointer = @parent_object.pointer
        key = @column_name
        related_class = Parse::Object @raw_hash['className']
        @objects = related_class.find! :where => proc {
          related_to key, pointer
        }
      end
      @objects
    end