Skip to content

Commit

Permalink
change verbosity of logs to clean up clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
jlewitt1 committed Feb 7, 2024
1 parent 6f7fda5 commit d362078
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions runhouse/resources/envs/conda_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def install(self, force=False):
install_hash = hash(str(env_config))
# Check the existing hash
if local_env_exists and install_hash in obj_store.installed_envs and not force:
logger.info("Env already installed, skipping")
logger.debug("Env already installed, skipping")
return
obj_store.installed_envs[install_hash] = self.name

Expand All @@ -131,7 +131,7 @@ def install(self, force=False):
else:
raise ValueError(f"package {package} not recognized")

logger.info(f"Installing package: {str(pkg)}")
logger.debug(f"Installing package: {str(pkg)}")
pkg._install(self)

return (
Expand Down
4 changes: 2 additions & 2 deletions runhouse/resources/envs/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def install(self, force=False):
install_hash = hash(str(env_config))
# Check the existing hash
if install_hash in obj_store.installed_envs and not force:
logger.info("Env already installed, skipping")
logger.debug("Env already installed, skipping")
return
obj_store.installed_envs[install_hash] = self.name

Expand All @@ -157,7 +157,7 @@ def install(self, force=False):
else:
raise ValueError(f"package {package} not recognized")

logger.info(f"Installing package: {str(pkg)}")
logger.debug(f"Installing package: {str(pkg)}")
pkg._install(self)
return self.run(self.setup_cmds) if self.setup_cmds else None

Expand Down
6 changes: 3 additions & 3 deletions runhouse/resources/hardware/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def check_server(self, restart_server=True):
if not self.client:
try:
self.connect_server_client()
logger.info(f"Checking server {self.name}")
logger.debug(f"Checking server {self.name}")
self.client.check_server()
logger.info(f"Server {self.name} is up.")
except (
Expand All @@ -523,7 +523,7 @@ def check_server(self, restart_server=True):
)
self.restart_server()
for i in range(5):
logger.info(f"Checking server {self.name} again [{i + 1}/5].")
logger.debug(f"Checking server {self.name} again [{i + 1}/5].")
try:
self.client.check_server()
logger.info(f"Server {self.name} is up.")
Expand Down Expand Up @@ -622,7 +622,7 @@ def restart_server(

if resync_rh:
self._sync_runhouse_to_cluster(_install_url=_rh_install_url)
logger.info("Finished syncing Runhouse to cluster.")
logger.debug("Finished syncing Runhouse to cluster.")

# Update the cluster config on the cluster
self.save_config_to_cluster()
Expand Down
2 changes: 1 addition & 1 deletion runhouse/resources/hardware/on_demand_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def _start_ray_workers(self, ray_port):
# NOTE: Using external worker address here because we're running from local
worker_ips.append(external)

logger.info(f"Internal head IP: {internal_head_ip}")
logger.debug(f"Internal head IP: {internal_head_ip}")

for host in worker_ips:
logger.info(
Expand Down
6 changes: 3 additions & 3 deletions runhouse/resources/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,9 +1023,9 @@ def _extract_pointers(raw_cls_or_fn: Union[Type, Callable], reqs: List[str]):
]

if len(base_dirs) != 1:
logger.info(f"Module files: {module_path}")
logger.info(f"Package paths: {package_paths}")
logger.info(f"Base dirs: {base_dirs}")
logger.debug(f"Module files: {module_path}")
logger.debug(f"Package paths: {package_paths}")
logger.debug(f"Base dirs: {base_dirs}")
raise Exception("Wasn't able to find the package directory!")
root_path = os.path.dirname(base_dirs[0])
module_name = py_module.__spec__.name
Expand Down
12 changes: 6 additions & 6 deletions runhouse/resources/provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def save(
if not config_for_rns["name"] or name:
config_for_rns["name"] = resolve_rns_path(name or self.name)
self._write_config(config=config_for_rns)
logger.info(f"Updated Run config name in path: {config_path}")
logger.debug(f"Updated Run config name in path: {config_path}")

return super().save(name, overwrite)

Expand Down Expand Up @@ -326,23 +326,23 @@ def result(self):
)
return self._load_blob_from_path(path=results_path).fetch()
elif run_status == RunStatus.ERROR:
logger.info("Run failed, returning stderr")
logger.debug("Run failed, returning stderr")
return self.stderr()
else:
logger.info(f"Run status: {self.status}, returning stdout")
logger.debug(f"Run status: {self.status}, returning stdout")
return self.stdout()

def stdout(self) -> str:
"""Read the stdout saved on the system for the Run."""
stdout_path = self._stdout_path
logger.info(f"Reading stdout from path: {stdout_path}")
logger.debug(f"Reading stdout from path: {stdout_path}")

return self._load_blob_from_path(path=stdout_path).fetch().decode().strip()

def stderr(self) -> str:
"""Read the stderr saved on the system for the Run."""
stderr_path = self._stderr_path
logger.info(f"Reading stderr from path: {stderr_path}")
logger.debug(f"Reading stderr from path: {stderr_path}")

return self._load_blob_from_path(stderr_path).fetch().decode().strip()

Expand Down Expand Up @@ -395,7 +395,7 @@ def _write_config(self, config: dict = None, overwrite: bool = True):
overwrite (Optional[bool]): Overwrite the config if one is already saved down. Defaults to ``True``.
"""
config_to_write = config or self.config_for_rns
logger.info(f"Config to save on system: {config_to_write}")
logger.debug(f"Config to save on system: {config_to_write}")
self.folder.put(
{self.RUN_CONFIG_FILE: config_to_write},
overwrite=overwrite,
Expand Down
2 changes: 1 addition & 1 deletion runhouse/resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def share(
# Update the resource in Den with this global visibility value
self.visibility = visibility

logger.info(f"Updating resource with visibility: {self.visibility}")
logger.debug(f"Updating resource with visibility: {self.visibility}")

self.save()

Expand Down
12 changes: 6 additions & 6 deletions runhouse/rns/rns_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,13 @@ def load_config(

if rns_address.startswith("/"):
resource_uri = self.resource_uri(name)
logger.info(f"Attempting to load config for {rns_address} from RNS.")
logger.debug(f"Attempting to load config for {rns_address} from RNS.")
resp = self.session.get(
f"{self.api_server_url}/resource/{resource_uri}",
headers=self.request_headers(),
)
if resp.status_code != 200:
logger.info(f"No config found in RNS: {load_resp_content(resp)}")
logger.debug(f"No config found in RNS: {load_resp_content(resp)}")
# No config found, so return empty config
return {}

Expand All @@ -343,7 +343,7 @@ def _load_config_from_local(self, rns_address=None, path=None) -> Optional[dict]
if not config_path.exists():
return None

logger.info(f"Loading config from local file {config_path}")
logger.debug(f"Loading config from local file {config_path}")
with open(config_path, "r") as f:
try:
config = json.load(f)
Expand Down Expand Up @@ -409,11 +409,11 @@ def _save_config_in_rns(self, config, resource_name):
f"{self.api_server_url}/{uri}", data=json.dumps(payload), headers=headers
)
if resp.status_code == 200:
logger.info(f"Config updated in Den for resource: {uri}")
logger.debug(f"Config updated in Den for resource: {uri}")
elif resp.status_code == 422: # No changes made to existing Resource
logger.info(f"Config for {uri} has not changed, nothing to update")
logger.debug(f"Config for {uri} has not changed, nothing to update")
elif resp.status_code == 404: # Resource not found
logger.info(f"Saving new resource in Den for resource: {uri}")
logger.debug(f"Saving new resource in Den for resource: {uri}")
# Resource does not yet exist, in which case we need to create from scratch
resp = self.session.post(
f"{self.api_server_url}/resource",
Expand Down

0 comments on commit d362078

Please sign in to comment.