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

Improve Naming of SyncDaemon #293

Merged
merged 2 commits into from
Oct 1, 2024
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
14 changes: 7 additions & 7 deletions xprof/sync_daemon_fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ global_handle = nil
parent_pid = nil

# Set trap
Signal.trap(Sync_daemon::RT_SIGNAL_GLOBAL_BARRIER) do
Signal.trap(SyncDaemon::RT_SIGNAL_GLOBAL_BARRIER) do
global_barrier(global_handle)
Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid)
Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid)
end

local_barier_count = 0
Signal.trap(Sync_daemon::RT_SIGNAL_LOCAL_BARRIER) do
Signal.trap(SyncDaemon::RT_SIGNAL_LOCAL_BARRIER) do
local_barier(local_barier_count.to_s)
local_barier_count += 1
Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid)
Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid)
end

Signal.trap(Sync_daemon::RT_SIGNAL_FINISH) do
Signal.trap(SyncDaemon::RT_SIGNAL_FINISH) do
# We cannot delete SHARED_LOCAL_FILESYSTEM
# Some rank can exit the `global_barier` (hence calling this function)
# when others ranks are still in the `local_barrier`
Expand All @@ -83,12 +83,12 @@ Signal.trap(Sync_daemon::RT_SIGNAL_FINISH) do
# is to make all ranks busy_wait in the `global_barrier`.
# This will ensure that every-one exited the `local_barrier`.
# but given the poor performance of our FS, we will avoid that for now...
Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid)
Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid)
exit
end

# Init global barrier
global_handle = init_global_barrier
parent_pid = ARGV[0].to_i
Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid)
Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid)
sleep
16 changes: 8 additions & 8 deletions xprof/xprof.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ end
# |_) _. ._ ._ o _ ._
# |_) (_| | | | (/_ |
#
class Sync_daemon
class SyncDaemon
SIGRTMIN = 34
RT_SIGNAL_READY = SIGRTMIN
RT_SIGNAL_GLOBAL_BARRIER = SIGRTMIN + 1
Expand Down Expand Up @@ -280,13 +280,13 @@ class Sync_daemon
end

LOGGER.debug { "spawn(#{daemon} #{Process.pid})" }
lazy_exec("Initialize Sync_daemon #{daemon_type}") do
lazy_exec("Initialize SyncDaemon #{daemon_type}") do
@pid = spawn("#{daemon} #{Process.pid}")
end
end

def finalize
lazy_exec('Finalize Sync_daemon') do
lazy_exec('Finalize SyncDaemon') do
`kill -#{RT_SIGNAL_FINISH} #{@pid}`
end
end
Expand All @@ -306,14 +306,14 @@ class Sync_daemon
# Context manager, ensure that when the block yield is exited
# we always call clean-up the daemon
def self.open
yield f = new
yield syncd = new
rescue Errno::ENOENT
exit(1)
ensure
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/EnsureReturn
if f
f.global_barrier
f.finalize
if syncd
syncd.global_barrier
syncd.finalize
end
end
end
Expand Down Expand Up @@ -669,7 +669,7 @@ def trace_and_on_node_processing(usr_argv)
lm_lttng_kill_sessiond
end

Sync_daemon.open do |syncd|
SyncDaemon.open do |syncd|
# Load Tracers and APILoaders Lib
backends, h = env_tracers

Expand Down