fix(webpage): remove duplicate EPS uploader, allow .svg uploads
EpsStatusGenerator was given its own upload_url when embedded in WebpageGeneratorBase, spinning up a second HttpUploader that redundantly re-scanned and re-POSTed the same shared output directory the base generator's own uploader already covers every cycle. It now always embeds with upload_url=None. Also adds .svg to HttpUploader's suffix whitelist so eps_synoptic.svg is actually picked up (matches a corresponding fix already applied server-side in upload.php/auth_gate.php). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit was merged in pull request #267.
This commit is contained in:
@@ -54,7 +54,7 @@ class HttpUploader:
|
||||
request is dropped (logged at DEBUG) rather than queuing up.
|
||||
"""
|
||||
|
||||
_UPLOAD_SUFFIXES = {".html", ".json", ".jpg", ".png", ".pdf", ".txt"}
|
||||
_UPLOAD_SUFFIXES = {".html", ".json", ".jpg", ".png", ".pdf", ".txt", ".svg"}
|
||||
_WARN_COOLDOWN_S = 600
|
||||
|
||||
def __init__(self, url: str, timeout: float = 20.0):
|
||||
|
||||
@@ -421,10 +421,11 @@ class WebpageGeneratorBase:
|
||||
for symmetry/override-ability, not because any
|
||||
current subclass needs it False. The EPS
|
||||
generator decides real-vs-demo data itself (see
|
||||
eps_status_generator._on_beamline_network) and is
|
||||
eps_status_generator._on_beamline_network),
|
||||
independent of the account-mismatch local_only
|
||||
fallback below: local_only only suppresses upload,
|
||||
it does not force demo data.
|
||||
fallback below. It never uploads on its own --
|
||||
this generator's own uploader already covers the
|
||||
whole shared output dir, EPS files included.
|
||||
"""
|
||||
|
||||
HAS_TOMO_QUEUE = True
|
||||
@@ -464,7 +465,6 @@ class WebpageGeneratorBase:
|
||||
self._cycle_interval = cycle_interval
|
||||
self._verbosity = verbosity
|
||||
self._uploader = HttpUploader(upload_url) if upload_url else None
|
||||
self._upload_url = upload_url # raw URL, passed through to EpsStatusGenerator
|
||||
self._local_port = local_port
|
||||
self._mismatch_local_port = mismatch_local_port
|
||||
self._local_server = None # created fresh each _launch()
|
||||
@@ -574,12 +574,16 @@ class WebpageGeneratorBase:
|
||||
|
||||
# EPS/machine-status pages (OMNY_shared/eps/): best-effort add-on,
|
||||
# sharing this output dir and LocalHttpServer (serve=False) so both
|
||||
# page families come up on the same port. Never uploaded from the
|
||||
# local_only fallback, same rule as the experiment page above -- but
|
||||
# real-vs-demo data is decided independently by the EPS generator
|
||||
# itself (see eps_status_generator._on_beamline_network), not by
|
||||
# local_only, so a mismatched account on the real beamline network
|
||||
# still gets real EPS data, just served locally.
|
||||
# page families come up on the same port. upload_url is always None
|
||||
# here -- this generator's own upload_changed_async(self._output_dir)
|
||||
# a few lines below already covers the whole shared directory,
|
||||
# including the eps_* files, every cycle; giving EpsStatusGenerator
|
||||
# its own upload_url as well would spin up a second HttpUploader
|
||||
# re-scanning and re-POSTing the same directory redundantly. Real-vs-
|
||||
# demo data is decided independently by the EPS generator itself
|
||||
# (see eps_status_generator._on_beamline_network), not by local_only,
|
||||
# so a mismatched account on the real beamline network still gets
|
||||
# real EPS data, just served locally.
|
||||
if self.HAS_EPS_STATUS:
|
||||
if self._eps is not None:
|
||||
try:
|
||||
@@ -589,7 +593,7 @@ class WebpageGeneratorBase:
|
||||
self._eps = EpsStatusGenerator(
|
||||
output_dir=self._output_dir,
|
||||
serve=False,
|
||||
upload_url=(None if local_only else self._upload_url),
|
||||
upload_url=None,
|
||||
)
|
||||
try:
|
||||
self._eps.start()
|
||||
|
||||
Reference in New Issue
Block a user