Skip to content

Conversation

@ataymano
Copy link
Contributor

@ataymano ataymano commented May 7, 2025

  • v0: original v0 implementation of single node
  • node: refactored v0 + mock instance implementation
  • master: master node for routing
  • client: debug clients (for single instance, node and master)

@@ -0,0 +1,121 @@
import os
from fastapi import FastAPI, HTTPException, Response
from fastapi.responses import JSONResponse, StreamingResponse
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging remove original worker node (omniboxes/v0) as latest single worker node is already under omniboxes/node

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To align with Kubernetes terminology rename folder from node to worker or workernode (if call master folder masternode)

Copy link
Collaborator

@ThomasDh-C ThomasDh-C left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface and class improvements from V0! General refactor needed to split up larger file and ensure overall class reuse.

def do_and_show(self, command, waitTime):
response = self.execute(command)
if response.status_code != 200:
raise Exception(f"Error: {response.status_code} - {response.text}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a chance that the subprocess runs so you get back status of 200, but the python program you executed failed for some reason so subprocess doesn't return a status code of 0. Add a check after this 200 check to check the return code from the actual execute step
https://github.com/microsoft/OmniParser/blob/5171b092483ab3e74ca50b9357e225f9f3571f18/omnitool/omnibox/vm/win11setup/setupscripts/server/main.py#L49C13-L61C20

response = self.execute(command)
if response.status_code != 200:
raise Exception(f"Error: {response.status_code} - {response.text}")
time.sleep(waitTime)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make this a class variable and then build it into execute function and wait before actual execute request is sent to windows vm?

self.output]))


class MasterClient:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break this file up into its individual clients

@@ -0,0 +1,8 @@
import logging

def default_logger():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove - duplicated in node_manager.py

import requests
import argparse

# Configure logging
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NodeManager will make its own logger if not passed in so this can be removed

from fastapi import FastAPI, HTTPException, Response
import requests

class InstanceClient:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should import from client folder - maybe we want to rename that to clients

response = requests.post(f"{self.url}/execute", json=command_data, timeout=5)
return JSONResponse(content=response.json(), status_code=response.status_code)
except requests.RequestException as e:
raise HTTPException(status_code=500, detail=f"Error communicating with theinstance {self.url}: {str(e)}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: space

from logging_utils import default_logger


class MockApp:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up names + docstrings of mock

draw = ImageDraw.Draw(image)

try:
font = ImageFont.truetype("DejaVuSans.ttf", 14)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed for mock - just use default

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be notebook be moved into a separate environment_management folder or sth similar?

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