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

Configure size upload limit #156

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
developmentMode = false

[server]
maxUploadSize = 200 #MB
port = 8501 # should be same as configured in deployment repo

[theme]

# The preset Streamlit theme that your custom theme inherits from. One of "light" or "dark".
# base =

Expand All @@ -22,4 +22,4 @@ primaryColor = "#29379b"
# textColor =

# Font family for all text in the app, except code blocks. One of "sans serif", "serif", or "monospace".
# font =
# font =
27 changes: 18 additions & 9 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ In the OpenMS web application, workspaces are designed to keep your analysis org
- **Workspace Specific Parameters and Files**: Each workspace stores parameters and files (uploaded input files and results from workflows).
- **Persistence**: Your workspaces and parameters are saved, so you can return to your analysis anytime and pick up where you left off. Simply bookmark the page!

## Online and Local Mode Differences

There are a few key differences between operating in online and local modes:
- **File Uploads**:
- *Online Mode*: You can upload only one file at a time. This helps manage server load and optimizes performance.
- *Local Mode*: Multiple file uploads are supported, giving you flexibility when working with large datasets.
- **Workspace Access**:
- In online mode, workspaces are stored temporarily and will be cleared after seven days of inactivity.
- In local mode, workspaces are saved on your local machine, allowing for persistent storage.
### File Uploads
- **Online Mode**: You can upload only one file at a time. This helps manage server load and optimizes performance.

- **Local Mode**: Multiple file uploads are supported, giving you flexibility when working with large datasets. Additionally, the file size upload limit can be adjusted in the following ways:
1. **Using `.streamlit/config.toml`**:
- You can modify the `.streamlit/config.toml` file and set the `maxUploadSize` parameter to your desired value. By default, this is set to 200MB.
- Example:
```toml
[server]
maxUploadSize = 500 # Set the upload limit to 500MB
```
2. **Using CLI Command**:
- You can customize the file size upload limit directly when running the application using the `--server.maxUploadSize` argument.
- Example:
```bash
python run_app.py --server.maxUploadSize 500
```
- This sets the upload limit to 500MB for the current session.

## Downloading Results

Expand Down
29 changes: 24 additions & 5 deletions run_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
from streamlit.web import cli
import subprocess
import sys
from streamlit.logger import get_logger

# Initialize a logger for this module
logger = get_logger(__name__)

if __name__ == "__main__":
cli._main_run_clExplicit(
file="app.py", command_line="streamlit run"
)
# we will create this function inside our streamlit framework
try:
# Construct the command to run the Streamlit app, including any additional command-line arguments
cmd = ["streamlit", "run", "app.py"] + sys.argv[1:]

# Log the constructed command at the debug level
logger.debug(f"Running command: {' '.join(cmd)}")

# Execute the command and check for errors
subprocess.run(cmd, check=True)

except subprocess.CalledProcessError as e:
# Log an error message if the Streamlit command fails
logger.error(f"Streamlit failed to run (error code {e.returncode})")
sys.exit(1)
except Exception as e:
# Log any unexpected errors that occur during execution
logger.error(f"Unexpected error: {str(e)}")
sys.exit(1)