Skip to content

refactor(remote): rework remote submission code#601

Merged
michael-johnston merged 27 commits intomaj_execution_contextsfrom
ap_20260223_refactor_remote_dispatch_2
Feb 24, 2026
Merged

refactor(remote): rework remote submission code#601
michael-johnston merged 27 commits intomaj_execution_contextsfrom
ap_20260223_refactor_remote_dispatch_2

Conversation

@AlessandroPomponio
Copy link
Member

@AlessandroPomponio AlessandroPomponio commented Feb 23, 2026

Changes

  • Use --remote instead of --execution-context in ado cli
  • Pass all argv arguments to the dispatch method
  • Use AdoConfiguration's builtin validation instead of custom validation for ProjectContext
  • Create RemoteSubmissionFlagSpec, RemoteSubmissionFlagMatch, ParsedRemoteSubmissionFlags pydantic models for handling flags for remote submission
  • Centralize utilities for handling arguments in orchestrator/cli/utils/remote/arg_parser.py
  • Remove duplicate code in orchestrator/cli/utils/remote/dispatch.py
  • Add uv to dependencies
  • Update documentation
  • Add and fix tests

AI - generated PR changes

Summary

This pull request refactors the remote execution feature by renaming ExecutionContext to RemoteExecutionContext, changing the CLI flag from --execution-context to --remote, and introducing a more maintainable, extensible argument parsing system for remote submission preparation.

Files Changed

📄 orchestrator/cli/core/cli.py

Refactored the CLI entry point to use the new --remote flag instead of --execution-context. Updated the common_options function to use RemoteExecutionContext and simplified _handle_remote_dispatch to pass the ProjectContext instance directly instead of a file path, eliminating the need to resolve context file paths.

📄 orchestrator/cli/core/config.py

Removed ExecutionContext tracking from AdoConfiguration. The _execution_context field and its accessor methods (execution_context property and set_execution_context method) were deleted as they are no longer needed.

📄 orchestrator/cli/models/__init__.py

Added module-level exports for the new remote submission flag models and specifications, making them available for import from the models package.

📄 orchestrator/cli/models/remote_submission.py

New file introducing a declarative, data-driven approach to handling CLI flags during remote submission preparation. Defines RemoteSubmissionFlagSpec for flag specifications, RemoteSubmissionFlagMatch for parsed flag instances, and ParsedRemoteSubmissionFlags for parsing results. Includes predefined flag specifications (REMOTE_FLAG, CONTEXT_FLAG, FILE_FLAG, WITH_FLAG) and flag groups for common operations.

📄 orchestrator/cli/utils/remote/__init__.py

Added module-level exports for remote dispatch utilities, including the new flag models and parsing functions.

📄 orchestrator/cli/utils/remote/arg_parser.py

New file providing position-aware argument parsing utilities. Implements parse_argv_with_positions for parsing argv with position tracking, strip_flags for removing specified flags, and rewrite_flag_values for transforming flag values. Replaces ad-hoc argument parsing with a generic, reusable approach.

📄 orchestrator/cli/utils/remote/dispatch.py

Refactored the remote dispatch implementation to use RemoteExecutionContext and the new argument parser. Updated dispatch to accept a ProjectContext instance instead of a file path, serializing it directly to YAML. Replaced manual argument parsing with calls to strip_flags and rewrite_flag_values. Updated _copy_files_and_rewrite_args to use the new parsing utilities. Changed clusterUrl to use pydantic.HttpUrl type.

📄 orchestrator/core/remotecontext/__init__.py

Renamed from orchestrator/core/executioncontext/__init__.py. Updated exports to use RemoteExecutionContext instead of ExecutionContext.

📄 orchestrator/core/remotecontext/config.py

Renamed from orchestrator/core/executioncontext/config.py. Renamed ExecutionContext to RemoteExecutionContext. Changed clusterUrl in ClusterExecutionType to use pydantic.HttpUrl with validation constraints instead of manual URL validation, removing the custom validate_cluster_url method.

📄 requirements.txt

Added uv==0.10.4 dependency with multiple platform-specific hashes for secure installation.

📄 tests/ado/test_remote_submission.py

Renamed from tests/ado/test_remote_dispatch.py. Comprehensive test suite updates to reflect the renaming and new argument parsing system. Added tests for the generic strip_flags and rewrite_flag_values functions, flag specification matching, and edge cases. Updated all test fixtures and assertions to use RemoteExecutionContext and the new flag models.

📄 tests/core/test_executioncontext.py

Updated all tests to use RemoteExecutionContext instead of ExecutionContext. Updated assertions to account for clusterUrl now being a pydantic.HttpUrl (which includes trailing slash in string representation).

Made with Bob

Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
@AlessandroPomponio AlessandroPomponio marked this pull request as draft February 23, 2026 13:27
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
@AlessandroPomponio AlessandroPomponio changed the title refactor(remote): simplify remote dispatch code refactor(remote): simplify remote submission code Feb 24, 2026
@AlessandroPomponio AlessandroPomponio changed the title refactor(remote): simplify remote submission code refactor(remote): simplify remote execution code Feb 24, 2026
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
@AlessandroPomponio AlessandroPomponio marked this pull request as ready for review February 24, 2026 13:32
It's now required for remote execution

Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
@AlessandroPomponio AlessandroPomponio changed the title refactor(remote): simplify remote execution code refactor(remote): rework remote submission code Feb 24, 2026
@michael-johnston michael-johnston merged commit 8e8e223 into maj_execution_contexts Feb 24, 2026
1 check passed
@michael-johnston michael-johnston deleted the ap_20260223_refactor_remote_dispatch_2 branch February 24, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants