feat: add Alibaba Function Compute serverless runtime provider support#643
Open
insight-bit wants to merge 12 commits intoalibaba:masterfrom
Open
feat: add Alibaba Function Compute serverless runtime provider support#643insight-bit wants to merge 12 commits intoalibaba:masterfrom
insight-bit wants to merge 12 commits intoalibaba:masterfrom
Conversation
b4c116d to
fc9b04b
Compare
Add comprehensive support for Alibaba Cloud Function Compute 3.0 (FC3) as a sandbox runtime provider, enabling serverless deployment of ROCK sandboxes with three deployment modes: - Custom Runtime: Lightweight Python runtime with bootstrap script - Custom Container: Full Docker container deployment - Hybrid Adapter: HTTP/WebSocket adapter for FC3 function integration Key components: - FC3 client with thread-safe CircuitBreaker for fault tolerance - WebSocket reconnection and retry mechanisms - Path traversal protection in server - Session affinity configuration (HEADER_FIELD mode) - Comprehensive test coverage (78 tests) Change-Id: Ic78b67b99949572ef75139bd3965b75b10a30a32 Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add FC3DeploymentConfig class to rock/deployments/config.py to fix ImportError in test_fc3_deployment.py. The config class provides: - FC3 function configuration (name, region, memory, cpus) - Authentication fields (account_id, access_key_id, access_key_secret) - Session affinity and TTL settings - get_deployment() method returning FC3Deployment instance Change-Id: If5022e63f00d85d3746b3c6a75bf8a4d09cda7e3 Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tests to verify FC3DeploymentConfig can be imported from rock.deployments.config module to prevent regression of the ImportError issue. - test_import_from_config_module: Verifies import works - test_is_deployment_config_subclass: Verifies inheritance Change-Id: I02292516eef42ec276bf76bc2476bfb77804e88d Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add security_token field to FC3DeploymentConfig for STS temporary credentials - Fix TestSandboxManagerFC3Integration to test deployment factory instead of non-existent SandboxManager FC3 routing - Fix test_config_missing_credentials to expect None defaults instead of empty strings Change-Id: I4609cea9405a3ab6f8a2c17b2c48b6639ed9ff4f Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add _fc3_deployments dict to store FC3 deployment instances - Add _fc3_deployments_lock for thread-safe access - Add _is_fc3_sandbox() method to check if sandbox is FC3 type - Add _start_fc3_sandbox() and _stop_fc3_sandbox() methods - Update tests to use dict-based sandbox type detection - Add skip conditions for tests requiring gem module Change-Id: Ie870d278e6a3ff0aa7d59f4f9bd22acbb1881b0f Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change-Id: Ic205ab5b0fa7f43774e1b642ecef9dbcda74a92e Co-developed-by: Claude <noreply@anthropic.com>
306aed4 to
6efd297
Compare
- Rename fc3.py to fc.py, FC3Deployment to FCDeployment - Rename fc3_rocklet/ to fc_rocklet/ - Update all FC3/FC3 references to FC in comments and strings - Remove FC3DeploymentConfig backward compatibility alias - Remove auto_clear_time property (use sandbox_ttl directly) - Fix async methods in tests (is_session_alive, get_session_stats) - Update test fixtures to include region and function_name FC (Function Compute) is Alibaba Cloud serverless compute service. The naming is simplified from FC3 to FC for clarity. Change-Id: I4053ac81b47f818cd8644a013857e99415fb9168 Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44ada74 to
c6c9100
Compare
- Rename sandbox_ttl → session_ttl (FC session lifetime) - Rename sandbox_idle_timeout → session_idle_timeout (FC session idle timeout) - Rename timeout → function_timeout (FC function execution timeout) - Update docstrings to use FC-native session terminology - Fix sandbox_manager.py to use new field names - Update tests to match new field names The FC layer uses "session" as its native concept, while "sandbox" is a ROCK abstraction. This change aligns the FC configuration with FC-native terminology for better clarity. Change-Id: Idc4d12c354a83d1cc95354d2de677f941c2ff3a5 Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename function_name from rock-rocklet-rt/rock-rocklet-adapter/rock-rocklet to unified "rock-serverless-runtime-rocklet" across all deployment modes - Update FCConfig default function_name - Update rock-fc.yml configuration - Update all s.yaml files (runtime/adapter/container) The three deployment modes are examples; production only needs one. Using a unified function_name simplifies configuration management. Change-Id: I3b862a369e866ef1ab94aea304ae08f134eae894 Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change-Id: Ica8c58c41eada8348d0ec045ade012c1ba22aedd Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add pytest-based E2E tests (test_fc_e2e.py) covering: - FC SDK protocol (health check, session lifecycle, command execution) - HTTP protocol (all rocklet endpoints) - WebSocket session operations - Error handling - Add shell script (run_e2e_http_tests.sh) for manual E2E testing: - Auto-detect FC URL from 's info' command - Support FC_URL environment variable override - Avoid pipe-based URL extraction for better resource handling - Fix /execute endpoint: add 'shell: true' to command requests to properly interpret shell command strings instead of treating them as executable paths Change-Id: I5df7887919c13fd58bbf8bbb5d58912c5bba7971 Co-developed-by: Claude <noreply@anthropic.com>
- Add 'need_fc' pytest marker and CI test step - Fix adapter execute(): add shell=True for proper command interpretation - Fix adapter route_request(): accept both 'session_id' and 'session' params - Add logConfig: auto to s.yaml for automatic SLS project creation - Update README with credential configuration instructions - Rename output files from fc3_rocklet to fc_rocklet for consistency Change-Id: Id918ca900a9a449a5499d2fe796543aaf0b0144a Co-developed-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #644
Summary
Key Components
FC3 Client (
rock/deployments/fc3.py)FC3Sandbox: Main sandbox client with session managementCircuitBreaker: Thread-safe fault tolerance with OPEN/CLOSED/HALF_OPEN statesFC3Error,FC3SandboxNotFoundError,FC3RuntimeErrorFC3 Rocklet (
rock/deployments/fc3_rocklet/)runtime/: Custom Runtime bootstrap and configurationcontainer/: Custom Container Dockerfile and configurationadapter/: Hybrid Adapter HTTP/WebSocket server with path traversal protectionTests
test_fc3_deployment.py: Client tests (48 tests)test_fc3_rocklet_adapter.py: Adapter endpoint tests (29 tests)test_fc3_rocklet_runtimes.py: Runtime config validation tests (49 tests)Test Plan
pytest tests/integration/deployments/test_fc3_*.py -v🤖 Generated with Claude Code