Module: Taski

Defined in:
lib/taski.rb,
lib/taski/task.rb,
lib/taski/context.rb,
lib/taski/section.rb,
lib/taski/version.rb,
lib/taski/execution/registry.rb,
lib/taski/execution/coordinator.rb,
lib/taski/execution/task_wrapper.rb,
lib/taski/static_analysis/visitor.rb,
lib/taski/static_analysis/analyzer.rb,
lib/taski/static_analysis/dependency_graph.rb,
lib/taski/execution/parallel_progress_display.rb

Defined Under Namespace

Modules: Execution, StaticAnalysis Classes: CircularDependencyError, Context, Section, Task, TaskAbortException

Constant Summary collapse

VERSION =
"0.4.2"

Class Method Summary collapse

Class Method Details

.contextContext?

Get the current execution context

Returns:

  • (Context, nil)

    The current context or nil if no task is running



35
36
37
# File 'lib/taski.rb', line 35

def self.context
  @context_monitor.synchronize { @context }
end

.global_registryObject



54
55
56
# File 'lib/taski.rb', line 54

def self.global_registry
  @global_registry ||= Execution::Registry.new
end

.progress_displayObject



62
63
64
65
# File 'lib/taski.rb', line 62

def self.progress_display
  return nil unless progress_enabled?
  @progress_display ||= Execution::ParallelProgressDisplay.new
end

.progress_enabled?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/taski.rb', line 67

def self.progress_enabled?
  ENV["TASKI_PROGRESS"] == "1" || ENV["TASKI_FORCE_PROGRESS"] == "1"
end

.reset_context!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Reset the execution context (internal use only)



50
51
52
# File 'lib/taski.rb', line 50

def self.reset_context!
  @context_monitor.synchronize { @context = nil }
end

.reset_global_registry!Object



58
59
60
# File 'lib/taski.rb', line 58

def self.reset_global_registry!
  @global_registry = nil
end

.reset_progress_display!Object



71
72
73
74
# File 'lib/taski.rb', line 71

def self.reset_progress_display!
  @progress_display&.stop
  @progress_display = nil
end

.start_context(options:, root_task:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Start a new execution context (internal use only)



41
42
43
44
45
46
# File 'lib/taski.rb', line 41

def self.start_context(options:, root_task:)
  @context_monitor.synchronize do
    return if @context
    @context = Context.new(options: options, root_task: root_task)
  end
end