예제 #1
0
    def _setup_services(
        bootstrap_options: OptionValueContainer,
        graph_scheduler: GraphScheduler,
    ):
        """Initialize pantsd services.

        :returns: A PantsServices instance.
        """
        build_root = get_buildroot()

        invalidation_globs = GlobalOptions.compute_pantsd_invalidation_globs(
            build_root,
            bootstrap_options,
        )

        scheduler_service = SchedulerService(
            graph_scheduler=graph_scheduler,
            build_root=build_root,
            invalidation_globs=invalidation_globs,
            pidfile=PantsDaemon.metadata_file_path(
                "pantsd", "pid", bootstrap_options.pants_subprocessdir),
            pid=os.getpid(),
            max_memory_usage_in_bytes=bootstrap_options.
            pantsd_max_memory_usage,
        )

        store_gc_service = StoreGCService(graph_scheduler.scheduler)
        return PantsServices(services=(scheduler_service, store_gc_service))
예제 #2
0
def test_invalidation_globs() -> None:
    # Confirm that an un-normalized relative path in the pythonpath is filtered out.
    suffix = "something-ridiculous"
    ob = OptionsBootstrapper.create(env={}, args=[f"--pythonpath=../{suffix}"], allow_pantsrc=False)
    globs = GlobalOptions.compute_pantsd_invalidation_globs(
        get_buildroot(), ob.bootstrap_options.for_global_scope()
    )
    for glob in globs:
        assert suffix not in glob
예제 #3
0
def test_invalidation_globs() -> None:
    # Confirm that an un-normalized relative path in the pythonpath is filtered out, and that an
    # empty entry (i.e.: a relative path for the current directory) doesn't cause an error.
    suffix = "something-ridiculous"
    ob = OptionsBootstrapper.create(
        env={},
        args=[f"--pythonpath=../{suffix}", "--pythonpath="],
        allow_pantsrc=False)
    globs = GlobalOptions.compute_pantsd_invalidation_globs(
        get_buildroot(), ob.bootstrap_options.for_global_scope())
    for glob in globs:
        assert suffix not in glob