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

Dev/native #108

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Extensions:

See [projects page](https://github.com/graphistry/graph-app-kit/projects) and [open pull requests](https://github.com/graphistry/graph-app-kit/pulls)

### Infra

* Enable native execution with stronger default env var handling


## [2.40.28 - 2023.08.16]

### Changed
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ cd graph-app-kit/private/graph-app-kit && docker-compose -p priv run -d --name s

3. [Main configurations and extensions](docs/extend.md): Database connectors, authentication, notebook-based editing, and more

### Native (Experimental)

Install dependencies, pick location of views folder, and run:

```bash
cd src/python
pip3 install -r requirements-system.txt
pip3 install -r requirements-app.txt
VIEW_PATH="`pwd`/views" streamlit run entrypoint.py
```

## The pieces

### Core
Expand Down
1 change: 1 addition & 0 deletions src/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ENV LANG=C.UTF-8
ENV BASE_URL=http://localhost:8501/dashboard
ENV BASE_PATH=dashboard/
ENV LOG_LEVEL=ERROR
ENV VIEW_PATH=/apps/views
COPY python/ /apps/

COPY docker/entrypoint.sh /entrypoint.sh
Expand Down
3 changes: 2 additions & 1 deletion src/python/components/AppPicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def list_modules(self):
# handler.flush()

modules_by_id = {}
for view_folder in sorted([view.split("/")[-1] for (view, _, _) in os.walk("/apps/views") if view != "/apps/views"]):
view_path = os.environ.get("VIEW_PATH", "/apps/views")
for view_folder in sorted([view.split("/")[-1] for (view, _, _) in os.walk(view_path) if view != view_path and not view.endswith("__pycache__")]):
try:
mod = importlib.import_module(f"views.{view_folder}")
if hasattr(mod, "run"):
Expand Down
10 changes: 3 additions & 7 deletions src/python/util/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ def getChild(*args, **kwargs):

logger = logging.getLogger('gak')

if "LOG_LEVEL" in os.environ:
log_level=getattr(logging, os.environ["LOG_LEVEL"].upper())
else:
log_level=getattr(logging,logging.ERROR)

logger.debug(f"util.log envar LOG_LEVEL: {os.environ['LOG_LEVEL']}")
logger.debug(f"util.log log_level == {log_level}")
log_level_str = os.environ.get('LOG_LEVEL', 'ERROR').upper()
log_level = getattr(logging, log_level_str)
logger.debug(f"util.log log_level == {log_level_str} ({log_level})")

out=logger.getChild(*args, **kwargs)
out.setLevel(log_level)
Expand Down
2 changes: 1 addition & 1 deletion src/python/views/demo_01_fancy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def sidebar_area():
n = st.sidebar.number_input('Number of nodes', min_value=10, max_value=100000, value=n_init, step=20)
urlParams.set_field('N', n)

base_url = os.environ['BASE_URL']
base_url = os.environ.get('BASE_URL', 'http://localhost:8501')

edges_df = pd.concat([
pd.DataFrame({
Expand Down
3 changes: 2 additions & 1 deletion src/python/views/demo_avr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import streamlit as st

# App configuration
CSS_PATH = "/apps/views/demo_avr/app.css"
view_path = os.environ.get("VIEW_PATH", "/apps/views")
CSS_PATH = f"{view_path}/demo_avr/app.css"
DEFAULT_PIVOT_URL_INVESTIGATION_ID = "123"

############################################
Expand Down