Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve feedback for uit connectivity issues #10

Open
kcpevey opened this issue Jul 29, 2019 · 0 comments
Open

Improve feedback for uit connectivity issues #10

kcpevey opened this issue Jul 29, 2019 · 0 comments

Comments

@kcpevey
Copy link

kcpevey commented Jul 29, 2019

The uit server is experiencing issues connecting to topaz and onyx. For the pyuit python package, the user feedback is not helpful in determining the location of breakage.

Connection to the uit server is working properly. From the Client, a command that calls the UIT_API_URL will work properly (and the uit dashboard is up and running properly). However, calls to the HPC machine url uit_client._uit_url will fail after several minutes. This python repo should develop some sort of catch for these issues to present a more intuitive response to the user.

Command: uit_client.list_dir() or uit_client.show_usage() (which gets called during a submit).

Traceback:

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-8-1f29a20625a2> in <module>
----> 1 uit_client.list_dir()

~/ers/gitHub/pyuit_jobs/uit/uit.py in wrapper(self, *args, **kwargs)
    111                                    f'Run "Client.connect" to connect to a system.')
    112 
--> 113             return func(self, *args, **kwargs)
    114         return wrapper
    115 

~/ers/gitHub/pyuit_jobs/uit/util.py in wrap_f(*args, **kwargs)
     24             while attempts <= retries:
     25                 try:
---> 26                     return func(*args, **kwargs)
     27                 except RuntimeError as e:
     28                     # "DP Route error" indicates failure of SSH Tunnel client on UIT Plus server.

~/ers/gitHub/pyuit_jobs/uit/uit.py in list_dir(self, path, parse, as_df)
    476             str: The API response as JSON
    477         """
--> 478         path = self._resolve_path(path, self.HOME)
    479 
    480         if not parse:

~/ers/gitHub/pyuit_jobs/uit/uit.py in HOME(self)
    116     @property
    117     def HOME(self):
--> 118         return PosixPath(self.env.HOME)
    119 
    120     @property

~/ers/gitHub/pyuit_jobs/uit/util.py in __getattr__(self, item)
     63 
     64     def __getattr__(self, item):
---> 65         return self.get(item)
     66 
     67     def __str__(self):

~/ers/gitHub/pyuit_jobs/uit/util.py in get(self, item, default)
     73     def get(self, item, default=None):
     74         if self._env.get(item) is None:
---> 75             self._env[item] = self.get_environmental_variable(item)
     76         return self._env.get(item) or default
     77 

~/ers/gitHub/pyuit_jobs/uit/util.py in get_environmental_variable(self, env_var_name, update)
     83             self._env[env_var_name] = self.client.call(
     84                 command=f'echo ${env_var_name}',
---> 85                 working_dir='.',
     86             ).strip() or None
     87 

~/ers/gitHub/pyuit_jobs/uit/uit.py in wrapper(self, *args, **kwargs)
    111                                    f'Run "Client.connect" to connect to a system.')
    112 
--> 113             return func(self, *args, **kwargs)
    114         return wrapper
    115 

~/ers/gitHub/pyuit_jobs/uit/util.py in wrap_f(*args, **kwargs)
     24             while attempts <= retries:
     25                 try:
---> 26                     return func(*args, **kwargs)
     27                 except RuntimeError as e:
     28                     # "DP Route error" indicates failure of SSH Tunnel client on UIT Plus server.

~/ers/gitHub/pyuit_jobs/uit/uit.py in call(self, command, working_dir, full_response, raise_on_error)
    402         data = {'options': json.dumps(data)}
    403         r = requests.post(urljoin(self._uit_url, 'exec'), headers=self._headers, data=data, verify=self.ca_file)
--> 404         resp = r.json()
    405         if full_response:
    406             return resp

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)
    895                     # used.
    896                     pass
--> 897         return complexjson.loads(self.text, **kwargs)
    898 
    899     @property

~/miniconda3/envs/adhui0715/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    352             parse_int is None and parse_float is None and
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:
    356         cls = JSONDecoder

~/miniconda3/envs/adhui0715/lib/python3.6/json/decoder.py in decode(self, s, _w)
    337 
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()
    341         if end != len(s):

~/miniconda3/envs/adhui0715/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
    355             obj, end = self.scan_once(s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
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

No branches or pull requests

1 participant