Skip to content

A template behavioral experiment ready to be deployed locally or on MTurk. Runs psiTurk, nginx, MySQL, & Adminer in networked docker containers. Includes slides from the accompanying tutorial.

Notifications You must be signed in to change notification settings

paxtonfitzpatrick/psiturk-experiment-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

psiturk-experiment-template

A template behavioral experiment ready to be run locally or deployed on Amazon Mechanical Turk. Slides from the accompanying tutorial are in slides/.

Commands

Starting the experiment server

  1. Start the Docker containers:

    $ docker-compose up -d
    Creating network "psiturk-experiment-template_default" with the default driver
    Creating my-experiment-adminer ... done
    Creating my-experiment-nginx   ... done
    Creating my-experiment         ... done
    Creating my-experiment-db      ... done

    When run for the first time, Docker will build the psiTurk image from Dockerfile and pull the others from Docker Hub.

  2. Attach standard input, output, and error to the psiTurk container:

    $ docker attach my-experiment
    root@dfeef3fee90e:/exp#

    If your shell prompt begins with root@, you're now inside the psiTurk container

  3. Launch the psiTurk shell:

    root@dfeef3fee90e:/exp# psiturk
    
    https://psiturk.org
     ______   ______     __     ______   __  __     ______     __  __
    /\  == \ /\  ___\   /\ \   /\__  _\ /\ \/\ \   /\  == \   /\ \/ /
    \ \  _-/ \ \___  \  \ \ \  \/_/\ \/ \ \ \_\ \  \ \  __<   \ \  _"-.
     \ \_\    \/\_____\  \ \_\    \ \_\  \ \_____\  \ \_\ \_\  \ \_\ \_\
      \/_/     \/_____/   \/_/     \/_/   \/_____/   \/_/ /_/   \/_/\/_/
    
                 an open platform for science on Amazon Mechanical Turk
    
    --------------------------------------------------------------------
    
    Due to a recent Amazon API deprecation, you need to install psiturk version 2.3.0 or later.
    
    v2.3.0 is python2 only, while versions of v2.3.x >= v2.3.1 support both python2 and python3.
    
    Check https://github.com/NYUCCL/psiTurk or https://psiturk.org for more info.
    psiTurk version 2.3.8
    Type "help" for more information.
    
  4. Switch the server on:

    [psiTurk server:off mode:sdbx #HITs:0]$ server on
    Experiment server launching...
    Now serving on http://0.0.0.0:22362
    

Running your experiment locally

With the experiment server on, run:

[psiTurk server:on mode:sdbx #HITs:0]$ debug
Launching browser pointed at your randomized debug link, feel free to request another.
	http://127.0.0.1:80/ad?assignmentId=debugXXXXXX&hitId=debugXXXXXX&workerId=debugXXXXXX&mode=debug

Note that the browser will not launch automatically because the server is running inside the Docker container. Copy/paste the generated link into a browser.

Testing your experiment in the MTurk sandbox

First, ensure that you're running in sandbox mode (the shell prompt should read "mode:sdbx"). With the experiment server on, run:

[psiTurk server:on mode:sdbx #HITs:0]$ hit create 1 0.01 1
*****************************
    Max workers: 1
    Reward: $0.01
    Duration: 1.0 hours
    Fee: $0.00
    ________________________
    Total: $0.01
Create sandbox HIT [y/n]? y
*****************************
  Created sandbox HIT
    HITid: 3BFF0DJK8YIPHERZLJFXL1DWL23TS0
    Max workers: 1
    Reward: $0.01
    Duration: 1.0 hours
    Fee: $0.00
    ________________________
    Total: $0.01
  Ad URL: https://sandbox.ad.psiturk.org/view/SskxbA8SWCGw3opFDiWEAW?assignmentId=debug63PAWI&hitId=debugVR03DZ&workerId=debugIJ3Q5T
Note: This url cannot be used to run your full psiTurk experiment.  It is only for testing your ad.
  MTurk URL: https://workersandbox.mturk.com/projects?filters%5Bsearch_term%5D=Example+MTurk+experiment
Hint: In OSX, you can open a terminal link using cmd + click
Note: This sandboxed ad will expire from the server in 16 days.

to create 1 sandbox HIT paying $0.01 (in fake money), available for 1 hour. Copy/paste the generated MTurk URL into a browser to view your MTurk listing and test your HIT, or use the Ad URL to test your HIT's advertisement. Note: the hit create command can also be run interactively by passing no parameters.

Posting live HITs for your experiment

First, ensure that you're running in live mode (the shell prompt should read "mode:live"). If you're running in sandbox (sdbx) mode, enter mode live and confirm when prompted to restart the server and switch to live mode. Then, create your HIT(s) with the hit create command as in sandbox mode

Approving, rejecting, and bonusing workers

see the psiTurk docs page on worker commands for a full guide to managing completed HITs

Resources

Relevant documentation

About

A template behavioral experiment ready to be deployed locally or on MTurk. Runs psiTurk, nginx, MySQL, & Adminer in networked docker containers. Includes slides from the accompanying tutorial.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published