sluice 0.1.2 → 0.1.3

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,21 @@
1
+ Version 0.1.3 (2013-10-02)
2
+ --------------------------
3
+ Added Ruby thread timeout monitoring (#4)
4
+
5
+ Version 0.1.2 (2013-09-10)
6
+ --------------------------
7
+ Fixed bug in manifest copy code
8
+
9
+ Version 0.1.1 (2013-09-10)
10
+ --------------------------
11
+ Fixed warning from Fog::Storage::AWS::File alias
12
+
13
+ Version 0.1.0 (2013-09-09)
14
+ --------------------------
15
+ Added ability to copy using a manifest
16
+ Added thread index to file operation puts
17
+ Added Contracts for some initial contract assertions
18
+
1
19
  Version 0.0.9 (2013-08-14)
2
20
  --------------------------
3
21
  Added ability to move and copy files between two different AWS accounts
@@ -17,6 +17,7 @@ require 'set'
17
17
  require 'tmpdir'
18
18
  require 'fog'
19
19
  require 'thread'
20
+ require 'timeout'
20
21
 
21
22
  require 'contracts'
22
23
  include Contracts
@@ -32,6 +33,7 @@ module Sluice
32
33
  CONCURRENCY = 10 # Threads
33
34
  RETRIES = 3 # Attempts
34
35
  RETRY_WAIT = 10 # Seconds
36
+ TIMEOUT_WAIT = 100 # Waiting longer reduces the chance that whatever caused the timeout recurs
35
37
 
36
38
  # Aliases for Contracts
37
39
  FogStorage = Fog::Storage::AWS::Real
@@ -737,20 +739,22 @@ module Sluice
737
739
  end
738
740
  module_function :glob_files
739
741
 
740
-
741
742
  # A helper function to attempt to run a
742
743
  # function retries times
743
744
  #
744
745
  # Parameters:
745
- # +function+:: Function to run
746
+ # +object+:: Object to send our function to
747
+ # +send_args+:: Function plus arguments
746
748
  # +retries+:: Number of retries to attempt
747
749
  # +attempt_msg+:: Message to puts on each attempt
748
750
  # +failure_msg+:: Message to puts on each failure
749
751
  def retry_x(object, send_args, retries, attempt_msg, failure_msg)
750
752
  i = 0
751
753
  begin
752
- object.send(*send_args)
753
- puts attempt_msg
754
+ Timeout::timeout(TIMEOUT_WAIT) do # In case our operation times out
755
+ object.send(*send_args)
756
+ puts attempt_msg
757
+ end
754
758
  rescue
755
759
  raise unless i < retries
756
760
  puts failure_msg
@@ -774,7 +778,7 @@ module Sluice
774
778
  # +add_path+:: If this is set, add this to the front of the path
775
779
  # +flatten+:: strips off any sub-folders below the from_location
776
780
  #
777
- # TODO: this really needs unit tests
781
+ # TODO: this badly needs unit tests
778
782
  def name_file(filepath, new_filename, remove_path=nil, add_path=nil, flatten=false)
779
783
 
780
784
  # First, replace the filename in filepath with new one
data/lib/sluice.rb CHANGED
@@ -19,5 +19,5 @@ require 'sluice/storage/s3'
19
19
 
20
20
  module Sluice
21
21
  NAME = "sluice"
22
- VERSION = "0.1.2"
22
+ VERSION = "0.1.3"
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sluice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-09-10 00:00:00.000000000 Z
13
+ date: 2013-10-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fog