Agent skill
remote-server-executor
Remote SSH server management and code execution with paramiko-based performance optimization
Install this agent skill to your Project
npx add-skill https://github.com/Ketomihine/my_skills/tree/main/remote-server-executor
SKILL.md
Remote Server Executor Skill
This skill provides comprehensive remote server management capabilities through SSH, with optimized performance and specialized biomedical data analysis features.
When to Use This Skill
This skill should be used when:
- Executing code on remote servers via SSH
- Managing files and directories on remote systems
- Analyzing large biomedical datasets (Robj, H5AD files) on remote servers
- Performance comparison between different SSH methods
- Managing conda environments and R packages on remote systems
Core Capabilities
1. SSH Connection Management
- High-performance paramiko-based SSH execution
- Connection optimization and error handling
- Multiple authentication methods support
2. Remote Code Execution
- Python code execution on remote servers
- R script execution with specified R versions
- Long-running process monitoring
- Real-time output capture
3. File Operations
- Remote file system navigation and exploration
- File upload/download operations
- Directory management and analysis
- Large dataset handling (GB-scale files)
4. Biomedical Data Analysis
- Seurat object (.robj) analysis and metadata extraction
- Single-cell RNA-seq data processing on remote servers
- H5AD to Seurat conversion capabilities
- Clinical data integration
5. Environment Management
- Conda environment setup and management
- R package installation (Seurat, dependencies)
- System resource monitoring
6. Performance Analysis
- Paramiko vs sshpass performance comparison
- Token consumption optimization
- Execution time analysis
Usage Instructions
Basic SSH Connection
config = {
'hostname': '10.71.223.201',
'port': 42022,
'username': 'lab_zhy',
'password': '55695543zhu'
}
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(**config)
Remote R Execution
# Execute R code with specific R version
r_code = '''
library(Seurat)
load("data.robj")
print(ls())
'''
stdin, stdout, stderr = ssh.exec_command(f'/usr/bin/R --vanilla << "EOF"\n{r_code}\nEOF')
Large File Analysis
# Analyze 12GB Robj files with extended timeout
analysis_script = '''
cd /media/zhy/zhydata/ncr
load("GSE183852_DCM_Integrated.Robj")
obj <- RefMerge
cat("Cells:", ncol(obj), "Genes:", nrow(obj), "\n")
'''
stdin, stdout, stderr = ssh.exec_command(analysis_script, timeout=1800)
Performance Testing
# Compare paramiko vs sshpass performance
paramiko_time = measure_paramiko_execution(config, test_command)
sshpass_time = measure_sshpass_execution(config, test_command)
File Structure
remote-server-executor/
├── SKILL.md # This documentation
├── remote-server-executor.py # Main SSH executor skill
├── ssh_wizard.py # SSH configuration wizard
├── performance_comparison.py # Performance analysis tool
├── token_consumption_test.py # Token usage analysis
├── test_connection.py # Connection testing
├── simple_test.py # Basic functionality test
├── install.py # Package installation
├── usage_examples.py # Usage examples
├── find_ncr_folder.py # NCR data discovery
├── check_ncr_folder.py # NCR folder analysis
├── view_ncr_file.py # NCR file inspection
├── check_ncr_directory.py # Directory content analysis
├── test_r_execution.py # R execution testing
├── simple_r_test.py # Basic R testing
├── install_seurat.py # Seurat package installation
├── read_robj_metadata.py # Robj metadata reading
├── simple_robj_check.py # Quick Robj validation
├── read_robj_with_timeout.py # Timeout-enabled Robj reading
├── quick_robj_info.py # Fast Robj information
├── use_existing_r_script.py # Existing R script execution
├── analyze_integrated_robj.py # Integrated Robj analysis
├── simple_integrated_check.py # Quick integrated analysis
├── direct_robj_analysis.py # Direct Robj analysis
├── check_metadata_without_seurat.py # Robj analysis without Seurat
└── analyze_with_conda_r.py # Conda environment R analysis
Key Features
Performance Optimization
- Paramiko-based implementation shows 11.5% better performance
- 81.3% reduction in token consumption compared to alternatives
- Optimized connection pooling and reuse
Biomedical Data Support
- Specialized handling for large single-cell datasets
- Seurat object metadata extraction without full loading
- Integration with conda environments for biomedical packages
Error Handling
- Comprehensive timeout management for long-running operations
- Graceful handling of connection failures
- Automatic retry mechanisms for unreliable connections
Configuration
Server Configuration
Default server configuration for biomedical data analysis:
BIOMEDICAL_SERVER = {
'hostname': '10.71.223.201',
'port': 42022,
'username': 'lab_zhy',
'password': '55695543zhu'
}
R Environment Configuration
R_EXECUTABLE_PATH = "/usr/bin/R"
CONDA_R_PATH = "/home/zhy/anaconda3/envs/base/bin/R"
OMICVERSE_ENV = "/home/zhy/anaconda3/envs/omicverse"
Integration with Other Skills
Seurat Single Cell Analysis
- Works seamlessly with
seurat-single-cellskill for format conversion - Handles large dataset preprocessing on remote servers
- Supports H5AD to Seurat conversion in conda environments
References
- Paramiko documentation: https://www.paramiko.org/
- Seurat single-cell analysis: https://satijalab.org/seurat/
- Remote server management best practices
- Biomedical data analysis workflows
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
cellchat-pkg-local-complete
CellChat 包源码随附的本地教程 + Rd 转换的函数文档 + R 源码 HTML - 完整覆盖173个文件
rapids-singlecell-complete
RAPIDS Single-Cell GPU 文档完整镜像
xenium-benchmarking-docs-local
Xenium benchmarking 本地文档快照(全量 HTML)- 包含完整模块文档
osta-docs-local
OSTA 本地文档(OSTA/)
cellphonedb
Comprehensive skill for CellPhoneDB - Database of cell type markers and cell-cell communication analysis for single-cell data. Use for cell type annotation, ligand-receptor analysis, cell-cell interaction inference, and communication network visualization.
spatialdata-docs-local
SpatialData 空间组学数据框架 - 100%覆盖271个核心文件(API文档+教程+示例+核心概念)
Didn't find tool you were looking for?