Skip to content

Commit

Permalink
api-change: remove /win_hash endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hartmann authored and JackUrb committed Mar 22, 2023
1 parent d85c3d6 commit b4ec4c8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 70 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ vis._send({'data': [trace], 'layout': layout, 'win': 'mywin'})
- [`vis.delete_env`](#visdelete_env) : delete an environment by env_id
- [`vis.win_exists`](#viswin_exists) : check if a window already exists by id
- [`vis.get_env_list`](#visget_env_list) : get a list of all of the environments on your server
- [`vis.win_hash`](#viswin_hash): get md5 hash of window's contents
- [`vis.get_window_data`](#visget_window_data): get current data for a window
- [`vis.check_connection`](#vischeck_connection): check if the server is connected
- [`vis.replay_log`](#visreplay_log): replay the actions from the provided log file
Expand Down Expand Up @@ -754,13 +753,6 @@ Optional arguments:

This function returns a list of all of the environments on the server at the time of calling. It takes no arguments.

#### vis.win_hash

This function returns md5 hash of the contents of a window `win` if it exists on the server. Returns None otherwise.

Optional arguments:
- `env` : Environment to search for the window in. Default is `None`.


#### vis.get_window_data
This function returns the window data for the given window. Returns data for all windows in an env if win is None.
Expand Down
34 changes: 0 additions & 34 deletions py/visdom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,40 +890,6 @@ def win_exists(self, win, env=None):
else:
return None

def _win_hash_wrap(self, win, env=None):
"""
This function returns a hash of the contents of
the window if the window exists.
Return None otherwise.
"""
assert win is not None

return self._send(
{
"win": win,
"env": env,
},
endpoint="win_hash",
quiet=True,
)

def win_hash(self, win, env=None):
"""
This function returns md5 hash of the contents
of a window if it exists on the server.
Returns None, otherwise
"""
try:
e = self._win_hash_wrap(win, env)
except ConnectionError:
print("Error connecting to Visdom server!")
return None

if re.match(r"([a-fA-F\d]{32})", e):
return e

return None

def _has_connection(self):
"""
This function returns a bool indicating whether or
Expand Down
4 changes: 0 additions & 4 deletions py/visdom/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
all of the required state about the currently running server.
"""

import copy
import hashlib
import logging
import os
import platform
Expand All @@ -39,7 +37,6 @@
ErrorHandler,
ExistsHandler,
ForkEnvHandler,
HashHandler,
IndexHandler,
PostHandler,
SaveHandler,
Expand Down Expand Up @@ -112,7 +109,6 @@ def __init__(
(r"%s/win_exists" % self.base_url, ExistsHandler, {"app": self}),
(r"%s/win_data" % self.base_url, DataHandler, {"app": self}),
(r"%s/delete_env" % self.base_url, DeleteEnvHandler, {"app": self}),
(r"%s/win_hash" % self.base_url, HashHandler, {"app": self}),
(r"%s/env_state" % self.base_url, EnvStateHandler, {"app": self}),
(r"%s/fork_env" % self.base_url, ForkEnvHandler, {"app": self}),
(r"%s/user/(.*)" % self.base_url, UserSettingsHandler, {"app": self}),
Expand Down
24 changes: 0 additions & 24 deletions py/visdom/server/handlers/web_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,30 +483,6 @@ def post(self):
self.wrap_func(self, args)


class HashHandler(BaseHandler):
def initialize(self, app):
self.app = app
self.state = app.state
self.login_enabled = app.login_enabled

@staticmethod
def wrap_func(handler, args):
eid = extract_eid(args)
handler_json = handler.state[eid]["jsons"]
if args["win"] in handler_json:
hashed = hash_md_window(handler_json[args["win"]])
handler.write(hashed)
else:
handler.write("false")

@check_auth
def post(self):
args = tornado.escape.json_decode(
tornado.escape.to_basestring(self.request.body)
)
self.wrap_func(self, args)


class EnvHandler(BaseHandler):
def initialize(self, app):
self.state = app.state
Expand Down

0 comments on commit b4ec4c8

Please sign in to comment.