feat(offload): refine for OS Login and add stop command

This commit is contained in:
mkorwel
2026-03-14 01:31:15 -07:00
parent fc1b5c0247
commit af9dc5be58
2 changed files with 20 additions and 1 deletions

View File

@@ -92,6 +92,22 @@ async function createImage() {
console.log(` 3. gcloud compute instances delete ${name} --project ${PROJECT_ID} --zone ${zone} --quiet`);
}
async function stopWorker() {
const name = INSTANCE_PREFIX;
const zone = 'us-west1-a';
console.log(`🛑 Stopping offload worker: ${name}...`);
const result = spawnSync('gcloud', [
'compute', 'instances', 'stop', name,
'--project', PROJECT_ID,
'--zone', zone
], { stdio: 'inherit' });
if (result.status === 0) {
console.log(`\n✅ Worker ${name} has been stopped.`);
}
}
async function main() {
const action = process.argv[2] || 'list';
@@ -102,6 +118,9 @@ async function main() {
case 'provision':
await provisionWorker();
break;
case 'stop':
await stopWorker();
break;
case 'create-image':
await createImage();
break;

View File

@@ -58,7 +58,7 @@ export async function runOrchestrator(args: string[], env: NodeJS.ProcessEnv = p
}
}
const remoteWorkDir = '/home/ubuntu/.offload/workspace';
const remoteWorkDir = '~/.offload/workspace';
const sessionName = `offload-${prNumber}-${action}`;