Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9809bc7
refactoring to run all setuid file access on user-specific worker pro…
krokicki Apr 12, 2026
e88956c
pass file descriptors using SCM_RIGHTS for performance
krokicki Apr 12, 2026
e07027b
fixed code
krokicki Apr 12, 2026
c4c6c4c
added worker tests and fixed SCM_RIGHTS bug
krokicki Apr 12, 2026
6d7ffa4
fixed recvmsg bug
krokicki Apr 12, 2026
3b6b455
add lock so workers only handle one request at a time
krokicki Apr 12, 2026
942dbca
show log when worker triggers 500 error
krokicki Apr 12, 2026
0dd3e09
worker error handling
krokicki Apr 12, 2026
b613c6d
enforce max_workers cap when all workers are busy
krokicki Apr 12, 2026
5fc0bdf
use settings for worker pool max_workers and idle_timeout
krokicki Apr 12, 2026
8841c9d
fix file descriptor leaks in _send_and_recv
krokicki Apr 12, 2026
18be1ae
add error handling to _action_get_file_info and _action_check_binary
krokicki Apr 12, 2026
aa73390
use os.getgrouplist() for worker supplementary groups
krokicki Apr 12, 2026
f351e7d
replace bare except with except Exception in head_object
krokicki Apr 12, 2026
5d678f8
use model_dump(mode='json') instead of json.loads(model_dump_json())
krokicki Apr 12, 2026
6b66a5a
add error handling for dev-mode worker action dispatch
krokicki Apr 12, 2026
7776d6a
use ctx.db_url consistently in job file action handlers
krokicki Apr 12, 2026
626da3d
add 120s socket timeout to worker IPC
krokicki Apr 12, 2026
7a7e407
remove dead code (EffectiveUserContext)
krokicki Apr 13, 2026
2bbf5ce
Merge remote-tracking branch 'origin/main' into refactor-workers
krokicki May 8, 2026
ff3d87e
linting
krokicki May 8, 2026
63fa53a
guard pwd import for Windows compatibility
krokicki May 8, 2026
2023f84
fix Windows build: prettier 3.8.3 reformat + grp import guard
krokicki May 8, 2026
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
2 changes: 1 addition & 1 deletion fileglancer/apps/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async def _ensure_repo_cache(url: str, pull: bool = False,

When username is provided, the work is delegated to a worker subprocess
that runs with the target user's real UID/GID, avoiding the process-wide
euid race condition that EffectiveUserContext has with concurrent async
euid race condition that seteuid/setegid has with concurrent async
requests. When username is None, git commands run in-process (used by
the worker subprocess itself, or in single-user dev mode).
"""
Expand Down
29 changes: 29 additions & 0 deletions fileglancer/filestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,35 @@ def stream_file_range(self, path: str = None, start: int = 0, end: int = 0, buff
file_handle.close()


@staticmethod
def _stream_contents(file_handle, buffer_size: int = DEFAULT_BUFFER_SIZE) -> Generator[bytes, None, None]:
"""Stream from an open file handle. Handle is closed when done."""
try:
while True:
chunk = file_handle.read(buffer_size)
if not chunk:
break
yield chunk
finally:
file_handle.close()

@staticmethod
def _stream_range(start: int, end: int, content_length: int,
file_handle, buffer_size: int = DEFAULT_BUFFER_SIZE) -> Generator[bytes, None, None]:
"""Stream a byte range from an open file handle. Handle is closed when done."""
try:
file_handle.seek(start)
remaining = content_length
while remaining > 0:
chunk_size = min(buffer_size, remaining)
chunk = file_handle.read(chunk_size)
if not chunk:
break
yield chunk
remaining -= len(chunk)
finally:
file_handle.close()

def rename_file_or_dir(self, old_path: str, new_path: str):
"""
Rename a file at the given old path to the new path.
Expand Down
691 changes: 315 additions & 376 deletions fileglancer/server.py

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions fileglancer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ class Settings(BaseSettings):
# Useful for setting up scheduler env (e.g., /misc/lsf/conf/profile.lsf).
env_source_script: Optional[str] = None

# Worker pool settings
worker_pool_max_workers: int = 50
worker_pool_idle_timeout: int = 300 # seconds

# Cluster / Apps settings (mirrors py-cluster-api ClusterConfig)
cluster: ClusterSettings = ClusterSettings()

Expand Down
135 changes: 0 additions & 135 deletions fileglancer/user_context.py

This file was deleted.

Loading
Loading