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

[BUG] missing user/pass for register() results in KeyError: 'org_name' in plot() #488

Open
DataBoyTX opened this issue May 25, 2023 · 2 comments
Assignees
Labels

Comments

@DataBoyTX
Copy link
Contributor

Describe the bug
missing user/pass is not failing on register(), but results in KeyError: 'org_name' on plot() call

To Reproduce

import pandas as pd

graphistry.register(api=3,  
                    protocol  = "http",
                    server    = "nginx",
                    username  = os.getenv("NON_EXISTENT_ENVAR"),
                    password  = os.getenv("NON_EXISTENT_ENVAR")
                   )

edf = pd.read_csv('https://raw.githubusercontent.com/graphistry/pygraphistry/master/demos/data/honeypot.csv')

graphistry.edges(edf, 'attackerIP', 'victimIP').plot()

Expected behavior
expect register to fail or warn

Actual behavior

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[8], line 4
      1 n_nodes=50 * 1000
      2 n_edges=1000
----> 4 create_and_plot_df(n_nodes, n_edges)

Cell In[7], line 31, in create_and_plot_df(n_nodes, n_edges, n_df, e_df)
     28 if e_df is None: 
     29     e_df = create_edge_df(n_nodes, n_edges)
---> 31 plot_url(n_df, e_df)

Cell In[7], line 9, in plot_url(n_df, e_df)
      6 g = graphistry.nodes(n_df, 'ID').edges(e_df,'src', 'dest').get_degrees()
      7 print(f'avg_degree = {round(g._nodes["degree"].sum()/len(g._nodes),2)}')
----> 9 url = SERVER + g.plot(render=False)
     10 time_taken = timeit.default_timer() - starttime
     11 #print(f'Time taken generate viz url: {str(round(time_taken/60,2))} mins')

File /opt/conda/envs/rapids/lib/python3.8/site-packages/graphistry/PlotterBase.py:1401, in PlotterBase.plot(self, graph, nodes, name, description, render, skip_upload, as_files, memoize, extra_html, override_html_style)
   1399 elif api_version == 3:
   1400     logger.debug("3. @PloatterBase plot: PyGraphistry.org_name(): {}".format(PyGraphistry.org_name()))
-> 1401     PyGraphistry.refresh()
   1402     logger.debug("4. @PloatterBase plot: PyGraphistry.org_name(): {}".format(PyGraphistry.org_name()))
   1404     dataset = self._plot_dispatch(g, n, name, description, 'arrow', self._style, memoize)

File /opt/conda/envs/rapids/lib/python3.8/site-packages/graphistry/pygraphistry.py:359, in PyGraphistry.refresh(token, fail_silent)
    357 """Use self or provided JWT token to get a fresher one. If self token, internalize upon refresh."""
    358 using_self_token = token is None
--> 359 logger.debug("1. @PyGraphistry refresh, org_name: {}".format(PyGraphistry._config['org_name']))
    360 try:
    361     if PyGraphistry.store_token_creds_in_memory():

KeyError: 'org_name'
@lmeyerov
Copy link
Contributor

@vaimdev Including on your plate next time we look at these

@vaimdev
Copy link
Contributor

vaimdev commented May 26, 2023

yes, noted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants