def new_scheduler()

in src/python/pants/engine/native.py [0:0]


  def new_scheduler(self,
                    tasks,
                    root_subject_types,
                    build_root,
                    work_dir,
                    local_store_dir,
                    ignore_patterns,
                    execution_options,
                    construct_directory_digest,
                    construct_snapshot,
                    construct_file_content,
                    construct_files_content,
                    construct_process_result,
                    type_address,
                    type_path_globs,
                    type_directory_digest,
                    type_snapshot,
                    type_merge_snapshots_request,
                    type_directory_with_prefix_to_strip,
                    type_files_content,
                    type_dir,
                    type_file,
                    type_link,
                    type_process_request,
                    type_process_result,
                    type_generator,
                    type_url_to_fetch):
    """Create and return an ExternContext and native Scheduler."""

    def func(fn):
      return Function(self.context.to_key(fn))
    def ti(type_obj):
      return TypeId(self.context.to_id(type_obj))

    scheduler = self.lib.scheduler_create(
        tasks,
        # Constructors/functions.
        func(construct_directory_digest),
        func(construct_snapshot),
        func(construct_file_content),
        func(construct_files_content),
        func(construct_process_result),
        # Types.
        ti(type_address),
        ti(type_path_globs),
        ti(type_directory_digest),
        ti(type_snapshot),
        ti(type_merge_snapshots_request),
        ti(type_directory_with_prefix_to_strip),
        ti(type_files_content),
        ti(type_dir),
        ti(type_file),
        ti(type_link),
        ti(type_process_request),
        ti(type_process_result),
        ti(type_generator),
        ti(type_url_to_fetch),
        ti(text_type),
        ti(binary_type),
        # Project tree.
        self.context.utf8_buf(build_root),
        self.context.utf8_buf(work_dir),
        self.context.utf8_buf(local_store_dir),
        self.context.utf8_buf_buf(ignore_patterns),
        self.to_ids_buf(root_subject_types),
        # Remote execution config.
        self.context.utf8_buf_buf(execution_options.remote_store_server),
        # We can't currently pass Options to the rust side, so we pass empty strings for None.
        self.context.utf8_buf(execution_options.remote_execution_server or ""),
        self.context.utf8_buf(execution_options.remote_execution_process_cache_namespace or ""),
        self.context.utf8_buf(execution_options.remote_instance_name or ""),
        self.context.utf8_buf(execution_options.remote_ca_certs_path or ""),
        self.context.utf8_buf(execution_options.remote_oauth_bearer_token_path or ""),
        execution_options.remote_store_thread_count,
        execution_options.remote_store_chunk_bytes,
        execution_options.remote_store_chunk_upload_timeout_seconds,
        execution_options.remote_store_rpc_retries,
        self.context.utf8_buf_buf(execution_options.remote_execution_extra_platform_properties),
        execution_options.process_execution_parallelism,
        execution_options.process_execution_cleanup_local_dirs,
      )
    return self.gc(scheduler, self.lib.scheduler_destroy)