Ruby‎ > ‎

Using Local Disk Storage

Local Temporary Storage

Workers can access up to 10 GB of local/cloud temporary storage by using user_dir in the worker which will return a path to the directory that your worker has write access to. 

Here is a code snippet as an example:

 

  class S3Worker < SimpleWorker::Base

    filepath = user_dir + "ironman.jpg"

    File.open(filepath, 'wb') do |fo|
      fo.write open("http://fitnessgurunyc.com/wp/wp-content/uploads/2010/12/ironman74.jpg").read
    end

    log "\nLocal 'user_dir' storage:"
    user_files = %x[ls #{user_dir.inspect}]
    log "#{user_files}"

  end


You can find the full example here: https://github.com/iron-io/simple_worker_examples/tree/master/s3_worker

Use Cases

Typical use cases might include:

  • downloading an image from S3, modifying it, and re-uploading it,
  • downloading a multi-megabyte log file, parsing it, and inserting it into a database,

Additional Capacity

There may be more local memory available depending on the type of server instance. If you need more capacity, contact us and we can address this via a premium tier offering.

Comments