Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/local-telemetry-agent' into obj-…
Browse files Browse the repository at this point in the history
…store-otel-export
  • Loading branch information
jlewitt1 committed Sep 17, 2024
2 parents d33453d + fe9c58d commit 4c5f277
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 42 deletions.
11 changes: 0 additions & 11 deletions runhouse/resources/envs/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,6 @@ def install(self, force: bool = False, cluster: Cluster = None, node: str = "all
on the current cluster. (Default: ``None``)
node (str, optional): Node to install the env on. (Default: ``"all"``)
"""

# Hash the config_for_rns to check if we need to install
env_config = self.config()
# Remove the name because auto-generated names will be different, but the installed components are the same
env_config.pop("name")
install_hash = hash(str(env_config))
# Check the existing hash
if install_hash in obj_store.installed_envs and not force:
logger.debug("Env already installed, skipping")
return
obj_store.installed_envs[install_hash] = self.name
# If we're doing the install remotely via SSH (e.g. for default_env), there is no cache
if not cluster:
# Hash the config_for_rns to check if we need to install
Expand Down
25 changes: 1 addition & 24 deletions runhouse/resources/hardware/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,29 +194,6 @@ def default_env(self, env):
"Run `cluster.restart_server()` to restart the Runhouse server on the new default env."
)

@classmethod
def from_name(
cls,
name,
load_from_den: bool = True,
dryrun: bool = False,
_alt_options: Dict = None,
_resolve_children: bool = True,
):
cluster = super().from_name(
name=name,
load_from_den=load_from_den,
dryrun=dryrun,
_alt_options=_alt_options,
_resolve_children=_resolve_children,
)
if hasattr(cluster, "_update_from_sky_status"):
try:
cluster._update_from_sky_status(dryrun=True)
except:
pass
return cluster

def save_config_to_cluster(
self,
node: str = None,
Expand Down Expand Up @@ -1958,4 +1935,4 @@ def _folder_mv(
)

def _folder_exists(self, path: Union[str, Path]):
return self.client.folder_exists(path=path)
return self.client.folder_exists(path=path)
1 change: 0 additions & 1 deletion runhouse/servers/env_servlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ def _get_env_cpu_usage(self, cluster_config: dict = None):
node_index,
)


def _get_env_gpu_usage(self):
# currently works correctly for a single node GPU. Multinode-clusters will be supported shortly.

Expand Down
2 changes: 0 additions & 2 deletions runhouse/servers/http/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,11 @@ async def get_object(
serialization: Optional[str] = "json",
remote: bool = False,
):
request_id = request.headers.get("X-Request-ID", str(uuid.uuid4()))
try:
return await obj_store.aget(
key=key,
serialization=serialization,
remote=remote,
request_id=request_id,
)
except Exception as e:
return handle_exception_response(
Expand Down
3 changes: 2 additions & 1 deletion tests/test_resources/test_clusters/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ def test_rh_status_pythonic(self, cluster):
"env_cpu_usage",
"env_gpu_usage",
"env_resource_mapping",
"node_index",
"node_ip",
"node_name",
"pid",
Expand Down Expand Up @@ -934,4 +935,4 @@ def test_switch_default_env(self, cluster):

# set it back
cluster.default_env = test_env
cluster.delete(new_env.name)
cluster.delete(new_env.name)
2 changes: 1 addition & 1 deletion tests/test_servers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,4 @@ def setup_cluster_config(local_cluster):

finally:
if cluster_config_path.exists():
cluster_config_path.unlink()
cluster_config_path.unlink()
4 changes: 2 additions & 2 deletions tests/test_servers/test_telemetry_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def test_send_span_to_collector_backend(self, local_telemetry_collector):
def test_send_span_with_local_agent_to_local_collector_backend(
self, local_telemetry_collector, local_telemetry_agent_for_local_backend
):

"""Generate a span and have a locally running Otel agent send it to a locally running collector backend"""
provider = TracerProvider()
trace.set_tracer_provider(provider)
Expand Down Expand Up @@ -74,7 +73,8 @@ def test_send_span_with_local_agent_to_collector_backend(
# Have the agent be responsible for sending the spans to the collector backend
endpoint = f"grpc://localhost:{local_telemetry_agent_for_runhouse_backend.agent_config.grpc_port}"
span_processor = BatchSpanProcessor(
OTLPSpanExporter(endpoint=endpoint, insecure=True))
OTLPSpanExporter(endpoint=endpoint, insecure=True)
)
trace.get_tracer_provider().add_span_processor(span_processor)

with tracer.start_as_current_span(f"span-from-agent-{str(uuid.uuid4())}"):
Expand Down

0 comments on commit 4c5f277

Please sign in to comment.