How do I disable the watcher in production?

Hi @thiago et. al.

I’m looking at the log files from my streamlit app. I I can see that my application creates Watchers when started via streamlit run app.py. I can see that later the watcher is created again.

I guess the watcher should be disabled in production. How do I do that?

(I have tried changing some of the configuration settings but without luck).

image

Thanks.

I updated the folderWatchBlacklist as shown below. The log no longer shows the Watcher created message.

Can someone from Streamlit confirmed that this is the correct way to disable hot reload in production?

Thanks

Hey @Marc

You’re very close :slight_smile:

The config option that disables the watchers is:

[server]
watchFileSystem = false

By the way: to see all available config options, run streamlit config show

1 Like

Thanks@thiago

But it actually does not show me the watchFileSystem. The output of the command is

Initialized tornado logs
# Below are all the sections and options you can have in ~/.streamlit/config.toml.

[global]

# By default, Streamlit checks if the Python watchdog module is available and, if not, prints a warning asking for you to install it. The watchdog module is not required,
but highly recommended. It improves Streamlit's ability to detect changes to files in your filesystem.
# If you'd like to turn off this warning, set this to True.
# Default: false
disableWatchdogWarning = false

# Configure the ability to share apps to the cloud.
# Should be set to one of these values: - "off" : turn off sharing. - "s3" : share to S3, based on the settings under the [s3] section of this config file.
# Default: "off"
sharingMode = "off"

# If True, will show a warning when you run a Streamlit-enabled script via "python my_script.py".
# Default: true
showWarningOnDirectExecution = true

# Level of logging: 'error', 'warning', 'info', or 'debug'.
# Default: 'info'
logLevel = "info"


[client]

# Whether to enable st.cache.
# Default: true
# The value below was set in H:\.streamlit\config.toml
caching = true

# If false, makes your Streamlit script not draw to a Streamlit app.
# Default: true
# The value below was set in H:\.streamlit\config.toml
displayEnabled = true


[runner]

# Allows you to type a variable or string by itself in a single line of Python code to write it to the app.
# Default: true
# The value below was set in H:\.streamlit\config.toml
magicEnabled = true

# Install a Python tracer to allow you to stop or pause your script at any point and introspect it. As a side-effect, this slows down your script's execution.
# Default: false
# The value below was set in H:\.streamlit\config.toml
installTracer = false

# Sets the MPLBACKEND environment variable to Agg inside Streamlit to prevent Python crashing.
# Default: true
# The value below was set in H:\.streamlit\config.toml
fixMatplotlib = true


[server]

# List of folders that should not be watched for changes. Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
# The value below was set in H:\.streamlit\config.toml
folderWatchBlacklist = []

# If false, will attempt to open a browser window on start.
# Default: false unless (1) we are on a Linux box where DISPLAY is unset, or (2) server.liveSave is set.
# The value below was set in H:\.streamlit\config.toml
headless = true

# Immediately share the app in such a way that enables live monitoring, and post-run analysis.
# Default: false
# The value below was set in H:\.streamlit\config.toml
liveSave = false

# Automatically rerun script when the file is modified on disk.
# Default: false
# The value below was set in H:\.streamlit\config.toml
runOnSave = false

# The port where the server will listen for client and browser connections.
# Default: 8501
# The value below was set in H:\.streamlit\config.toml
port = 8000

# Enables support for Cross-Origin Request Sharing, for added security.
# Default: true
# The value below was set in H:\.streamlit\config.toml
enableCORS = true


[browser]

# Internet address of the server server that the browser should connect to. Can be IP address or DNS name.
# Default: 'localhost'
# The value below was set in H:\.streamlit\config.toml
serverAddress = "127.0.0.1"

# Whether to send usage statistics to Streamlit.
# Default: true
# The value below was set in H:\.streamlit\config.toml
gatherUsageStats = true

# Port that the browser should use to connect to the server when in liveSave mode.
# Default: whatever value is set in server.port.
# The value below was set in H:\.streamlit\config.toml
serverPort = 8000


[s3]

# Name of the AWS S3 bucket to save apps.
# Default: (unset)
#bucket =

# URL root for external view of Streamlit apps.
# Default: (unset)
#url =

# Access key to write to the S3 bucket.
# Leave unset if you want to use an AWS profile.
# Default: (unset)
#accessKeyId =

# Secret access key to write to the S3 bucket.
# Leave unset if you want to use an AWS profile.
# Default: (unset)
#secretAccessKey =

# Make the shared app visible only to users who have been granted view permission. If you are interested in this option, contact us at support@streamlit.io.
# Default: false
# The value below was set in H:\.streamlit\config.toml
requireLoginToView = false

# The "subdirectory" within the S3 bucket where to save apps.
# S3 calls paths "keys" which is why the keyPrefix is like a subdirectory. Use "" to mean the root directory.
# Default: ""
# The value below was set in H:\.streamlit\config.toml
keyPrefix = ""

# AWS region where the bucket is located, e.g. "us-west-2".
# Default: (unset)
#region =

# AWS credentials profile to use.
# Leave unset to use your default profile.
# Default: (unset)
#profile =

Oooooh you’re totally right! Sorry about that.

watchFilesystem was an old setting, way back in the day. We have since refactored the code a lot and haven’t reintroduced support for that. Will do ASAP.

2 Likes

I’m invoking streamlit with --server.fileWatcherType=none, but for some reason I still see logs saying Watcher created ....

Any thoughts on what I could be doing wrong here?