Skip to content
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
4 changes: 4 additions & 0 deletions helm/numtracker/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ spec:
value: {{ .Values.numtracker.storage.mount }}/{{ .Values.numtracker.db.fileName }}
- name: NUMTRACKER_PORT
value: "{{- .Values.service.port -}}"
{{- with .Values.numtracker.rootTrackerDirectory }}
- name: NUMTRACKER_ROOT_DIRECTORY
value: {{ . }}
{{ end }}
{{- if .Values.numtracker.tracing.enabled }}
- name: NUMTRACKER_TRACING
value: {{ .Values.numtracker.tracing.host }}
Expand Down
10 changes: 9 additions & 1 deletion src/numtracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::path::{Path, PathBuf};
pub use tests::TempTracker;
use tokio::fs as async_fs;
use tokio::sync::{Mutex, MutexGuard};
use tracing::{instrument, trace};
use tracing::{info, instrument, trace};

/// Central controller to access external directory trackers. Prevents concurrent access to the same
/// beamline's directory.
Expand All @@ -35,10 +35,18 @@ impl NumTracker {
pub fn for_root_directory<P: AsRef<Path>>(root: Option<P>) -> Result<Self, Error> {
let mut bl_locks: HashMap<String, Mutex<PathBuf>> = Default::default();
if let Some(dir) = root {
info!(
"Managing external number tracker files in subdirectories of {:?}",
dir.as_ref()
);
for entry in dir.as_ref().read_dir()? {
let dir = entry?;
if dir.file_type()?.is_dir() {
if let Ok(name) = dir.file_name().into_string() {
info!(
"Using {:?} as external tracker directory for {name}",
dir.path()
);
bl_locks.insert(name, Mutex::new(dir.path()));
}
}
Expand Down
Loading