Skip to content

Commit

Permalink
Revert "Integrate scheduler with server (Issue #8009, PR #8050)"
Browse files Browse the repository at this point in the history
This reverts commit 0ad385c.
  • Loading branch information
wouterdb committed Sep 9, 2024
1 parent 70d2e72 commit 8b49f0d
Show file tree
Hide file tree
Showing 18 changed files with 97 additions and 950 deletions.
4 changes: 0 additions & 4 deletions changelogs/unreleased/8009-server-scheduler.yml

This file was deleted.

21 changes: 5 additions & 16 deletions mypy-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ src/inmanta/protocol/methods.py:0: error: Function is missing a return type anno
src/inmanta/protocol/methods.py:0: note: Use "-> None" if function does not return a value
src/inmanta/protocol/methods.py:0: error: Function is missing a return type annotation [no-untyped-def]
src/inmanta/protocol/methods.py:0: error: Function is missing a return type annotation [no-untyped-def]
src/inmanta/protocol/methods.py:0: error: Missing return statement [empty-body]
src/inmanta/protocol/methods.py:0: error: Function is missing a return type annotation [no-untyped-def]
src/inmanta/protocol/methods.py:0: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
src/inmanta/protocol/methods.py:0: error: Function is missing a return type annotation [no-untyped-def]
Expand Down Expand Up @@ -972,7 +971,6 @@ src/inmanta/app.py:0: error: Missing type parameters for generic type "Future"
src/inmanta/app.py:0: error: Argument 2 to "safe_shutdown" has incompatible type "Callable[[int | None], Coroutine[Any, Any, None]]"; expected "Callable[[], None]" [arg-type]
src/inmanta/app.py:0: error: Argument 2 to "safe_shutdown" has incompatible type "Callable[[int | None], Coroutine[Any, Any, None]]"; expected "Callable[[], None]" [arg-type]
src/inmanta/app.py:0: error: Incompatible types in assignment (expression has type "str | None", variable has type "int | None") [assignment]
src/inmanta/app.py:0: error: Incompatible types in assignment (expression has type "str | None", variable has type "int | None") [assignment]
src/inmanta/app.py:0: error: Argument 1 to "run" of "Exporter" has incompatible type "dict[str, Type]"; expected "dict[str, Entity] | None" [arg-type]
src/inmanta/app.py:0: error: No overload variant of "print" matches argument types "str", "TextIO | Any", "dict[str, object]" [call-overload]
src/inmanta/app.py:0: note: Possible overload variants:
Expand All @@ -993,16 +991,9 @@ src/inmanta/compiler/help/explainer.py:0: error: Item "None" of "RelationAttribu
src/inmanta/agent/resourcepool.py:0: error: Missing type parameters for generic type "PoolMember" [type-arg]
src/inmanta/agent/resourcepool.py:0: error: Argument 1 to "append" of "list" has incompatible type "Callable[[TPoolMember], Coroutine[Any, Any, bool]]"; expected "Callable[[PoolMember[TPoolID]], Coroutine[Any, Any, Any]]" [arg-type]
src/inmanta/agent/resourcepool.py:0: error: Missing type parameters for generic type "PoolMember" [type-arg]
src/inmanta/deploy/scheduler.py:0: error: Argument "attribute_hash" to "ResourceDetails" has incompatible type "str | None"; expected "str" [arg-type]
src/inmanta/deploy/scheduler.py:0: error: No overload variant of "list" matches argument type "object" [call-overload]
src/inmanta/deploy/scheduler.py:0: note: Possible overload variants:
src/inmanta/deploy/scheduler.py:0: note: def [_T] __init__(self) -> list[_T]
src/inmanta/deploy/scheduler.py:0: note: def [_T] __init__(self, Iterable[_T], /) -> list[_T]
src/inmanta/agent/forking_executor.py:0: error: Argument 1 of "connection_made" is incompatible with supertype "BaseProtocol"; supertype defines the argument type as "BaseTransport" [override]
src/inmanta/agent/forking_executor.py:0: note: This violates the Liskov substitution principle
src/inmanta/agent/forking_executor.py:0: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
src/inmanta/agent/agent_new.py:0: error: Argument 3 to "MPManager" has incompatible type "UUID | None"; expected "UUID" [arg-type]
src/inmanta/agent/agent_new.py:0: error: Argument 1 to "collect_report" has incompatible type "inmanta.agent.agent_new.Agent"; expected "inmanta.agent.agent.Agent" [arg-type]
src/inmanta/agent/agent.py:0: error: Cannot determine type of "ratelimiter" [has-type]
src/inmanta/validation_type.py:0: error: Incompatible types in assignment (expression has type "object", variable has type "Mapping[str, object] | None") [assignment]
src/inmanta/server/validate_filter.py:0: error: Incompatible return value type (got "Callable[[object], list[tuple[RangeOperator, int]] | None]", expected "Callable[[object, object], list[tuple[RangeOperator, int]] | None]") [return-value]
Expand Down Expand Up @@ -1150,10 +1141,7 @@ src/inmanta/data/dataview.py:0: error: Return type "Sequence[dict[str, str]]" of
src/inmanta/data/dataview.py:0: error: Argument "discovered_resource_id" to "DiscoveredResource" has incompatible type "object"; expected "ResourceIdStr" [arg-type]
src/inmanta/data/dataview.py:0: error: Argument 1 to "loads" has incompatible type "object"; expected "str | bytes | bytearray" [arg-type]
src/inmanta/data/dataview.py:0: error: Argument "discovery_resource_id" to "DiscoveredResource" has incompatible type "object"; expected "ResourceIdStr | None" [arg-type]
src/inmanta/server/services/compilerservice.py:0: error: Incompatible types in assignment (expression has type "bool | int | float | str | dict[str, str | int | bool]", variable has type "int") [assignment]
src/inmanta/server/server.py:0: error: Argument 1 to "get_global_url_map" of "RESTServer" has incompatible type "dict_values[str, ServerSlice]"; expected "list[CallTarget]" [arg-type]
src/inmanta/server/agentmanager.py:0: error: Argument 1 to "_ensure_scheduler" of "AutostartedAgentManager" has incompatible type "Environment | None"; expected "Environment" [arg-type]
src/inmanta/server/agentmanager.py:0: error: Argument 1 to "ensure_agent_registered" of "AgentManager" has incompatible type "Environment | None"; expected "Environment" [arg-type]
src/inmanta/server/services/resourceservice.py:0: error: Argument "args" to "__init__" of "LogRecord" has incompatible type "list[Never]"; expected "tuple[object, ...] | Mapping[str, object] | None" [arg-type]
src/inmanta/server/services/resourceservice.py:0: error: Module has no attribute "_startTime" [attr-defined]
src/inmanta/server/services/resourceservice.py:0: error: Missing type parameters for generic type "Feature" [type-arg]
Expand All @@ -1164,10 +1152,6 @@ src/inmanta/server/services/resourceservice.py:0: error: Value of type variable
src/inmanta/server/services/resourceservice.py:0: error: Unsupported target for indexed assignment ("Mapping[str, BaseModel | UUID | bool | int | float | datetime | str | Sequence[BaseModel | UUID | bool | int | float | datetime | str] | Mapping[str, BaseModel | UUID | bool | int | float | datetime | str]] | None") [index]
src/inmanta/server/services/resourceservice.py:0: error: Incompatible return value type (got "dict[ResourceIdStr, ResourceState]", expected "dict[str, ResourceState]") [return-value]
src/inmanta/server/services/resourceservice.py:0: error: Module "inmanta.server.protocol" does not explicitly export attribute "handle" [attr-defined]
src/inmanta/server/services/paramservice.py:0: error: Unsupported operand types for + ("None" and "timedelta") [operator]
src/inmanta/server/services/paramservice.py:0: note: Left operand is of type "datetime | None"
src/inmanta/server/services/paramservice.py:0: error: Unsupported operand types for > ("timedelta" and "datetime") [operator]
src/inmanta/server/services/paramservice.py:0: note: Left operand is of type "datetime | timedelta"
src/inmanta/server/services/orchestrationservice.py:0: error: "object" has no attribute "__iter__"; maybe "__dir__" or "__str__"? (not iterable) [attr-defined]
src/inmanta/server/services/orchestrationservice.py:0: error: Argument 1 to "append" of "list" has incompatible type "Resource"; expected "dict[str, Any]" [arg-type]
src/inmanta/server/services/orchestrationservice.py:0: error: Unsupported target for indexed assignment ("Resource") [index]
Expand All @@ -1178,3 +1162,8 @@ src/inmanta/server/services/orchestrationservice.py:0: error: Incompatible types
src/inmanta/server/services/orchestrationservice.py:0: error: Incompatible types in assignment (expression has type "set[str | None]", variable has type "set[str]") [assignment]
src/inmanta/server/services/orchestrationservice.py:0: error: Argument "agents" to "_trigger_auto_deploy" of "OrchestrationService" has incompatible type "Collection[str]"; expected "Sequence[str] | None" [arg-type]
src/inmanta/server/services/orchestrationservice.py:0: error: Incompatible return value type (got "ReturnValueWithMeta[Sequence[DesiredStateVersion]]", expected "ReturnValue[list[DesiredStateVersion]]") [return-value]
src/inmanta/server/services/compilerservice.py:0: error: Incompatible types in assignment (expression has type "bool | int | float | str | dict[str, str | int | bool]", variable has type "int") [assignment]
src/inmanta/server/services/paramservice.py:0: error: Unsupported operand types for + ("None" and "timedelta") [operator]
src/inmanta/server/services/paramservice.py:0: note: Left operand is of type "datetime | None"
src/inmanta/server/services/paramservice.py:0: error: Unsupported operand types for > ("timedelta" and "datetime") [operator]
src/inmanta/server/services/paramservice.py:0: note: Left operand is of type "datetime | timedelta"
7 changes: 0 additions & 7 deletions src/inmanta/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,13 +1331,6 @@ async def trigger_update(self, env: uuid.UUID, agent: str, incremental_deploy: b
)
return 200

@protocol.handle(methods.trigger_read_version, env="tid")
async def read_version(self, env: uuid.UUID) -> Apireturn:
"""
Send a notification to the agent that a new version has been released
"""
pass

@protocol.handle(methods.resource_event, env="tid", agent="id")
async def resource_event(
self,
Expand Down
265 changes: 0 additions & 265 deletions src/inmanta/agent/agent_new.py

This file was deleted.

25 changes: 0 additions & 25 deletions src/inmanta/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,31 +142,6 @@ def start_agent(options: argparse.Namespace) -> None:
LOGGER.info("Agent Shutdown complete")


@command("scheduler", help_msg="Start the resource scheduler")
def start_scheduler(options: argparse.Namespace) -> None:
"""
Start the new agent with the Resource Scheduler
"""
from inmanta.agent import agent_new

# The call to configure() should be done as soon as possible.
# If an AsyncHTTPClient is started before this call, the max_client
# will not be taken into account.
max_clients: Optional[int] = Config.get(section="agent_rest_transport", name="max_clients")

if max_clients:
AsyncHTTPClient.configure(None, max_clients=max_clients)

tracing.configure_logfire("agent_rs")
util.ensure_event_loop()
a = agent_new.Agent()

setup_signal_handlers(a.stop)
IOLoop.current().add_callback(a.start)
IOLoop.current().start()
LOGGER.info("Agent with Resource scheduler Shutdown complete")


class ExperimentalFeatureFlags:
"""
Class to expose feature flag configs as options in a uniform matter
Expand Down
Loading

0 comments on commit 8b49f0d

Please sign in to comment.