Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Programming > Libraries

    iron-worker 0.0.11

    Download button

    No screenshots available
    Downloads: 70  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Iron.io | More programs
    Other/Proprietary Li... / FREE
    February 26th, 2012, 16:41 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    iron-worker description

    The Python client for IronWorker, a cloud service for background processing

    iron_worker_python is Python language binding for IronWorker.

    IronWorker is a massively scalable background processing system. See How It Works

    Getting Started

    Get credentials

    To start using iron_worker_python, you need to sign up and get an oauth token.

    1. Go to http://iron.io/ and sign up.
    2. Get an Oauth Token at http://hud.iron.io/tokens

    Install iron_worker_python

    Just copy iron_worker.py and poster and include iron_worker.py in your script:

    from iron_worker import *

    Configure

    Two ways to configure IronWorker:

    - Specifying options when constructing the binding:

    worker = IronWorker(token='XXXXXXXXXX', project_id='xxxxxxxxxxx')

    - Passing an ini file name which stores your configuration options. Rename sample_config.ini to config.ini and include your Iron.io credentials (token and project_id):

    worker = IronWorker(config='config.ini')

    Creating a Worker

    Here's an example worker:

    print "Hello PYTHON World!\n"

    Upload code to server

    - Zip worker:

    # Zip single file:
    IronWorker.createZip(destination="worker.zip", files=['HelloWorld.py'], overwrite=True)
    # OR
    # Zip whole directory:
    IronWorker.zipDirectory(directory="hello_world/", destination='worker.zip', overwrite=True)


    - Submit worker:

    res = worker.postCode(runFilename='HelloWorld.py', zipFilename='worker.zip', name='HelloWorld')

    Where 'HelloWorld' is a worker name which should be used later for queueing and sheduling.

    Queueing a Worker

    task = worker.postTask(name='HelloWorld')

    Worker should start in a few seconds.

    Scheduling a Worker

    If you want to run your code at a delay, you should schedule it:

    # 3 minutes from now
    start_at = 3*60
    worker.postSchedule(name='HelloWorld', delay=start_at)


    Status of a Worker

    To get the status of a worker, you can use the getTaskDetails() method.

    task = worker.postTask('HelloWorld')
    details = worker.getTaskDetails(task_id=task['tasks'][0]['id']);


    print details['status'] # prints 'queued', 'complete', 'error' etc.

    Get Worker Log

    Use any function that print text inside your worker to put messages to log.

    import time
    task = worker.postTask('HelloWorld')
    time.sleep(10)
    details = worker.getTaskDetails(task['tasks'][0]['id'])
    # Check log only if task is finished.
    if details['status'] != 'queued':
     log = worker.getLog(task_id);
     print log # prints "Hello PHP World!"


    Loading the Task Data Payload

    To provide Payload to your worker simply put a dict with any content you want.

    payload = {
     'key_one': 'Helpful text',
     'key_two': 2,
     'options': ['option 1', 'option 2']
    }


    worker.postTask(name='HelloWorld', payload=payload)

    When your code is executed, it will be passed three program arguments:

    - -id - The task id.
    - -payload - the filename containing the data payload for this particular task.
    - -d - the user writable directory that can be used while running your job.

    Full Documentation

    You can find more documentation here:

    - http://docs.iron.io Full documetation for iron.io products.
    - IronWorker Python Wiki pages.


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    IronWorker client | Python library | Python | IronWorker | client



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM