scout-rig 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +31 -13
  3. data/README.md +27 -4
  4. data/Rakefile +1 -0
  5. data/VERSION +1 -1
  6. data/doc/Improvements.md +396 -0
  7. data/doc/StartHere.md +95 -0
  8. data/doc/developer/Architecture.md +232 -0
  9. data/doc/developer/DataConversionInternals.md +407 -0
  10. data/doc/developer/DesignPrinciples.md +254 -0
  11. data/doc/developer/PythonTaskRunnerInternals.md +371 -0
  12. data/doc/developer/PythonWorkflowInternals.md +539 -0
  13. data/doc/developer/ScoutPythonInternals.md +504 -0
  14. data/doc/user/Cookbook.md +337 -0
  15. data/doc/user/DefiningPythonTasks.md +708 -0
  16. data/doc/user/DrivingWorkflowsFromPython.md +418 -0
  17. data/doc/user/IteratingPythonData.md +142 -0
  18. data/doc/user/PassingDataToPython.md +223 -0
  19. data/doc/user/PythonEnvironments.md +197 -0
  20. data/doc/user/RunningPythonFromRuby.md +267 -0
  21. data/doc/user/ScriptingPython.md +281 -0
  22. data/doc/user/TestingAndPackaging.md +487 -0
  23. data/lib/scout/python/script.rb +11 -2
  24. data/lib/scout/python/util.rb +9 -0
  25. data/lib/scout/workflow/python/inputs.rb +33 -23
  26. data/lib/scout/workflow/python/task.rb +219 -18
  27. data/lib/scout/workflow/python.rb +236 -9
  28. data/lib/scout-rig/testing/availability.rb +608 -0
  29. data/python/README.md +51 -0
  30. data/python/scout/__init__.py +2 -0
  31. data/python/scout/runner.py +193 -29
  32. data/python/scout/task_errors.py +6 -0
  33. data/research/00_scope_and_themes.md +131 -0
  34. data/research/data-conversion-and-scripting-analysis.md +209 -0
  35. data/research/design-philosophy-analysis.md +246 -0
  36. data/research/python-helper-package-analysis.md +272 -0
  37. data/research/pythonworkflow-analysis.md +199 -0
  38. data/research/scoutpython-bridge-analysis.md +185 -0
  39. data/research/synthesis-report.md +109 -0
  40. data/research/testing-availability-baseline.md +1625 -0
  41. data/research/testing-availability-final-report.md +500 -0
  42. data/research/validation-report.md +149 -0
  43. data/scout-rig.gemspec +35 -5
  44. data/test/scout/python/test_util.rb +13 -0
  45. data/test/scout/test_python.rb +10 -0
  46. data/test/scout/workflow/python/test_task.rb +1119 -1
  47. data/test/scout-rig/testing/test_availability.rb +495 -0
  48. data/test/scout-rig/testing/test_test_support.rb +166 -0
  49. data/test/test_helper.rb +96 -19
  50. metadata +47 -4
  51. data/doc/Python.md +0 -482
  52. data/doc/PythonWorkflow.md +0 -163
data/test/test_helper.rb CHANGED
@@ -3,37 +3,115 @@ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib
3
3
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
4
4
 
5
5
  require 'scout'
6
+ require 'scout/testing'
7
+ require 'scout/testing/scout_state'
6
8
 
7
- class Test::Unit::TestCase
9
+ # Test-only availability probes (scout-rig testing support). Loaded here so
10
+ # every test file can gate optional prerequisites with omit; NOT required by
11
+ # any production entry point.
12
+ require 'scout-rig/testing/availability'
8
13
 
9
- def assert_equal_path(path1, path2)
10
- assert_equal File.expand_path(path1), File.expand_path(path2)
11
- end
14
+ class Test::Unit::TestCase
15
+ include Scout::Testing::Assertions
12
16
 
13
17
  def self.tmpdir
14
- @@tmpdir ||= Path.setup('tmp/test_tmpdir').find
18
+ @@tmpdir ||= Path.setup('tmp/test_tmpdir_scout_rig').find
15
19
  end
16
20
 
17
21
  def tmpdir
18
22
  @tmpdir ||= Test::Unit::TestCase.tmpdir
19
23
  end
20
24
 
25
+ def capture_instance_variable(owner, name)
26
+ [owner.instance_variable_defined?(name), owner.instance_variable_get(name)]
27
+ end
28
+
29
+ def restore_instance_variable(owner, name, state)
30
+ was_defined, value = state
31
+ if was_defined
32
+ owner.instance_variable_set(name, value)
33
+ elsif owner.instance_variable_defined?(name)
34
+ owner.remove_instance_variable(name)
35
+ end
36
+ end
37
+
38
+ def capture_rig_test_state
39
+ {
40
+ progress_severity: capture_instance_variable(Log::ProgressBar, :@default_severity),
41
+ entity_property_cache: defined?(Entity) && capture_instance_variable(Entity, :@entity_property_cache),
42
+ workflow_directory: capture_instance_variable(Workflow, :@directory),
43
+ workflows: Workflow.workflows.map do |workflow|
44
+ tasks = workflow.instance_variable_get(:@tasks) || {}
45
+ [workflow, capture_instance_variable(workflow, :@directory),
46
+ tasks.values.map { |task| [task, capture_instance_variable(task, :@directory)] }]
47
+ end,
48
+ job_cache: capture_instance_variable(Workflow, :@job_cache)
49
+ }
50
+ end
51
+
52
+ def restore_rig_test_state
53
+ state = @scout_rig_test_state
54
+ return unless state
55
+
56
+ restore_instance_variable(Log::ProgressBar, :@default_severity, state[:progress_severity])
57
+ restore_instance_variable(Entity, :@entity_property_cache, state[:entity_property_cache]) if state[:entity_property_cache]
58
+ restore_instance_variable(Workflow, :@directory, state[:workflow_directory])
59
+ state[:workflows].each do |workflow, directory, tasks|
60
+ restore_instance_variable(workflow, :@directory, directory)
61
+ tasks.each { |task, task_directory| restore_instance_variable(task, :@directory, task_directory) }
62
+ end
63
+ restore_instance_variable(Workflow, :@job_cache, state[:job_cache])
64
+ ensure
65
+ @scout_rig_test_state = nil
66
+ end
67
+
21
68
  setup do
22
69
  Open.rm_rf tmpdir
23
- TmpFile.tmpdir = tmpdir.tmpfiles
24
- Log::ProgressBar.default_severity = 0
25
- Persist.cache_dir = tmpdir.var.cache
26
- Persist::MEMORY_CACHE.clear
27
- Open.remote_cache_dir = tmpdir.var.cache
28
- Workflow.directory = tmpdir.var.jobs
29
- Workflow.workflows.each{|wf| wf.directory = Workflow.directory[wf.name] }
30
- Entity.entity_property_cache = tmpdir.entity_properties if defined?(Entity)
31
- Workflow.job_cache.clear
32
- SchedulerJob.batch_base_dir = tmpdir.batch
33
- end
34
-
70
+ @scout_rig_test_state = capture_rig_test_state
71
+ @scout_testing_state = Scout::Testing::State.new(tmpdir, bindings: [
72
+ # Keep Rig's intentional shared cache layout while letting State restore
73
+ # the simple accessor-backed paths.
74
+ [Persist, :cache_dir, 'var/cache'],
75
+ [Open, :remote_cache_dir, 'var/cache'],
76
+ [SchedulerJob, :batch_base_dir, 'batch']
77
+ ])
78
+ begin
79
+ @scout_testing_state.activate
80
+ Log::ProgressBar.default_severity = 0
81
+
82
+ # These settings have Path-valued or derived semantics; keep their
83
+ # setup/definedness restoration local rather than binding string paths.
84
+ Workflow.directory = tmpdir.var.jobs
85
+ Workflow.workflows.each { |wf| wf.directory = Workflow.directory[wf.name] }
86
+ Entity.entity_property_cache = tmpdir.entity_properties if defined?(Entity)
87
+
88
+ # Isolate task memoization without destructively clearing the prior map.
89
+ Workflow.job_cache = {}
90
+ rescue Exception
91
+ begin
92
+ restore_rig_test_state
93
+ ensure
94
+ begin
95
+ @scout_testing_state.restore if @scout_testing_state
96
+ ensure
97
+ @scout_testing_state = nil
98
+ Open.rm_rf tmpdir
99
+ end
100
+ end
101
+ raise
102
+ end
103
+ end
104
+
35
105
  teardown do
36
- Open.rm_rf tmpdir
106
+ begin
107
+ restore_rig_test_state
108
+ ensure
109
+ begin
110
+ @scout_testing_state.restore if @scout_testing_state
111
+ ensure
112
+ Open.rm_rf tmpdir
113
+ end
114
+ end
37
115
  end
38
116
 
39
117
  def self.datadir_test
@@ -52,4 +130,3 @@ class Test::Unit::TestCase
52
130
  Test::Unit::TestCase.datafile_test(file)
53
131
  end
54
132
  end
55
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-rig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
@@ -37,6 +37,20 @@ dependencies:
37
37
  - - ">"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: scout-essentials
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">"
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">"
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
40
54
  description: Use other coding languages in your scout applications
41
55
  email: mikisvaz@gmail.com
42
56
  executables: []
@@ -51,9 +65,25 @@ files:
51
65
  - README.md
52
66
  - Rakefile
53
67
  - VERSION
54
- - doc/Python.md
55
- - doc/PythonWorkflow.md
68
+ - doc/Improvements.md
69
+ - doc/StartHere.md
70
+ - doc/developer/Architecture.md
71
+ - doc/developer/DataConversionInternals.md
72
+ - doc/developer/DesignPrinciples.md
73
+ - doc/developer/PythonTaskRunnerInternals.md
74
+ - doc/developer/PythonWorkflowInternals.md
75
+ - doc/developer/ScoutPythonInternals.md
76
+ - doc/user/Cookbook.md
77
+ - doc/user/DefiningPythonTasks.md
78
+ - doc/user/DrivingWorkflowsFromPython.md
79
+ - doc/user/IteratingPythonData.md
80
+ - doc/user/PassingDataToPython.md
81
+ - doc/user/PythonEnvironments.md
82
+ - doc/user/RunningPythonFromRuby.md
83
+ - doc/user/ScriptingPython.md
84
+ - doc/user/TestingAndPackaging.md
56
85
  - lib/scout-rig.rb
86
+ - lib/scout-rig/testing/availability.rb
57
87
  - lib/scout/python.rb
58
88
  - lib/scout/python/paths.rb
59
89
  - lib/scout/python/run.rb
@@ -67,10 +97,23 @@ files:
67
97
  - python/pyproject.toml
68
98
  - python/scout/__init__.py
69
99
  - python/scout/runner.py
100
+ - python/scout/task_errors.py
70
101
  - python/scout/workflow.py
71
102
  - python/scout/workflow/remote.py
72
103
  - python/test.py
104
+ - research/00_scope_and_themes.md
105
+ - research/data-conversion-and-scripting-analysis.md
106
+ - research/design-philosophy-analysis.md
107
+ - research/python-helper-package-analysis.md
108
+ - research/pythonworkflow-analysis.md
109
+ - research/scoutpython-bridge-analysis.md
110
+ - research/synthesis-report.md
111
+ - research/testing-availability-baseline.md
112
+ - research/testing-availability-final-report.md
113
+ - research/validation-report.md
73
114
  - scout-rig.gemspec
115
+ - test/scout-rig/testing/test_availability.rb
116
+ - test/scout-rig/testing/test_test_support.rb
74
117
  - test/scout/python/test_run.rb
75
118
  - test/scout/python/test_script.rb
76
119
  - test/scout/python/test_util.rb
@@ -96,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
139
  - !ruby/object:Gem::Version
97
140
  version: '0'
98
141
  requirements: []
99
- rubygems_version: 3.7.0.dev
142
+ rubygems_version: 4.0.23
100
143
  specification_version: 4
101
144
  summary: Scouts rigging things together
102
145
  test_files: []