deadly_serious 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dfdbc7c45af05380d213ab4011d4228e2e8b6af
4
- data.tar.gz: 089e715ec1cc97af1b01b43d6bc8133a33353bb3
3
+ metadata.gz: 775816edf4860d7516908442da4d8ffaa2793aba
4
+ data.tar.gz: 0516bbdbccd02bf0102833c1dfcbe2ecc1bbac9f
5
5
  SHA512:
6
- metadata.gz: e1e87aca37f80261b0ab8f0d7e1786d5fa20d224bed7277a0eb72833200f9a47b198f888b1d77a6e15af3a2a479237d1715dccff0b460fafffe934012179e316
7
- data.tar.gz: b5df200c7451bf4d058dea4b791b013c93c5ed0a5dbb3715a41deecee859c7a4249c42b5145a28fa3a8d6e881a46d9dffc046939f61a5d90492fc51e52485535
6
+ metadata.gz: 9ddb27632bffcbba2bd7c9f008e0662b27c5dcdcd048ae244cffbe577f7afdcfb19c5c7723891dde7f221f9cf81ccd7681d0aec0ebc9e62d6f25c7cf3820ec7a
7
+ data.tar.gz: d49e4442d46a296c638d84e6120ae83d25f174d55e353c34e2a63a9741a5116b49f738be2a8642356f84932fa16872884b0a01ec66ca233013a62173adecd609
data/README.md CHANGED
@@ -11,14 +11,14 @@ Unlike [NoFlo](http://noflojs.org), this is not a real engine. It just "orchestr
11
11
  Overall, it's slower than a normal ruby program (the pipes add some overhead). However, there are 4 points where this approach is pretty interesting:
12
12
 
13
13
  1. High modifiabilty:
14
- * The interfaces between each component is tiny and very clear: they are just streams of characteres. I usually use csv format or json when I need more structure than that.
15
- * You can connect ruby process to anything else that deals with STDIN, STDOUT or files (which includes shell commands, of course).
14
+ * The interface between each component is tiny and very clear: it's just a stream of characteres. I usually use csv format or json when I need more structure than that.
15
+ * You can connect ruby process to anything that deals with STDIN, STDOUT or files (which includes shell commands, of course).
16
16
  2. Cheap parallelism and distributed computation:
17
- * Each component runs as a separated process. The OS is in charge here (and it does a amazing work running things in parallel).
18
- * As any shell command can be use as a component, you can use a simple [ncat](http://nmap.org/ncat) (or something similar) to disttribute jobs between different boxes.
17
+ * Each component runs as a separated process. The OS is in charge here (and it does an amazing work running things in parallel).
18
+ * As any shell command can be used as a component, you can use a simple [ncat](http://nmap.org/ncat) (or something similar) to distribute jobs between different boxes.
19
19
  * It's really easy to avoid deadlocks and race conditions with the FBP paradigm.
20
20
  3. Low memory footprint
21
- * As each component usually process things as they appear in the pipe, it's easy to crush tons of data using very little memory. Notable exceptions as components that needs to accumulate things to process, like "sort".
21
+ * As each component usually process things as they appear in the pipe, it's easy to crush tons of data with very low memory. Notable exceptions as components that needs to accumulate things to process, like "sort".
22
22
  4. Very easy to reason about (personal opinion):
23
23
  * Of course, this is not a merit of this gem, but of Flow Based Programming in general. I dare do say (oh, blasphemy!) that Object Oriented and Functional programming paradigms are good ONLY for tiny systems. They make a huge mess on big ones (#prontofalei).
24
24
 
@@ -7,13 +7,10 @@ module DeadlySerious
7
7
  def initialize(data_dir: './data', pipe_dir: "/tmp/deadly_serious/#{Process.pid}", preserve_pipe_dir: false)
8
8
  @data_dir = data_dir
9
9
  @pipe_dir = pipe_dir
10
+ @preserve_pipe_dir = preserve_pipe_dir
10
11
  @ids = []
11
12
 
12
13
  FileUtils.mkdir_p(pipe_dir) unless File.exist?(pipe_dir)
13
-
14
- unless preserve_pipe_dir
15
- at_exit { FileUtils.rm_r(pipe_dir, force: true, secure: true) }
16
- end
17
14
  end
18
15
 
19
16
  def run
@@ -22,6 +19,10 @@ module DeadlySerious
22
19
  rescue Exception => e
23
20
  kill_children
24
21
  raise e
22
+ ensure
23
+ if !@preserve_pipe_dir && File.exist?(@pipe_dir)
24
+ FileUtils.rm_r(@pipe_dir, force: true, secure: true)
25
+ end
25
26
  end
26
27
 
27
28
  def spawn_source(a_class, *args, writer: self.class.dasherize(a_class.name))
@@ -1,3 +1,3 @@
1
1
  module DeadlySerious
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deadly_serious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronie Uliana