コード例 #1
0
def upload():
    """Upload generated web files into S3"""
    print '* Uploading sandbox...'
    fns = glob.glob(os.path.join(TMPDIR_SANDBOX, '*.*'))
    mt.upload_files(fns, S3BUCKET, dstprefix=SANDBOXPATH + '/', test=True,
            verbose=10)

    print '* Uploading production...'
    fns = glob.glob(os.path.join(TMPDIR_PRODUCTION, '*.*'))
    mt.upload_files(fns, S3BUCKET, dstprefix=PRODUCTIONPATH + '/', test=True,
            verbose=10)
コード例 #2
0
ファイル: driver.py プロジェクト: feziodoshi/mturkutils
def publish(sandbox=True):
    """Publish to the sandbox"""
    states = pk.load(open(os.path.join(TMPDIR, STATES)))
    s_t0 = str(states['t0'])
    kwd = ['compensation', 'reimbursement', s_t0]
    extkwd = EXTKWD.split(',')
    if len(extkwd) > 0:
        print '* Extra keywords:', extkwd
        kwd += extkwd

    exp = mt.Experiment(None, None, sandbox=sandbox,
        keywords=kwd,
        max_assignments=states['n_assignments'],
        title=states['title'],
        reward=states['compamt'],
        duration=1500,
        description="***For invited workers only***",
        comment="compensation, reimbursement",
        collection_name=None,   # disables db connection
        meta=None,
        )

    if sandbox:
        fns = sorted(states['dstfns_sandbox'])
    else:
        fns = sorted(states['dstfns_production'])

    hitidslog = os.path.join(TMPDIR, 'hitidslog_' +
            ('sandbox' if sandbox else 'production') + '_' +
            s_t0 + '.pkl')
    URLlist = ['https://s3.amazonaws.com/' + S3BUCKET +
            e.split(TMPDIR)[-1] for e in fns]
    exp.createHIT(verbose=True, URLlist=URLlist, hitidslog=hitidslog)

    fns = [hitidslog]
    dfns = ['hitidslog_' + 'sandbox.pkl' if sandbox else 'production.pkl']
    mt.upload_files(fns, S3BUCKET, dstprefix=DATAFNPREFIX % s_t0,
            test=True, verbose=10, acl=None, dstfiles=dfns)

    print '* t0 was:', s_t0
コード例 #3
0
ファイル: driver.py プロジェクト: feziodoshi/mturkutils
def upload():
    """Upload generated web files into S3"""
    states = pk.load(open(os.path.join(TMPDIR, STATES)))
    s_t0 = str(states['t0'])

    print '* Uploading sandbox...'
    fns = glob.glob(os.path.join(TMPDIR_SANDBOX, '*.*'))
    mt.upload_files(fns, S3BUCKET, dstprefix=SANDBOXPATH + '/', test=True,
            verbose=10)

    print '* Uploading production...'
    fns = glob.glob(os.path.join(TMPDIR_PRODUCTION, '*.*'))
    mt.upload_files(fns, S3BUCKET, dstprefix=PRODUCTIONPATH + '/', test=True,
            verbose=10)

    print '* Uploading data...'
    fns = [os.path.join(TMPDIR, STATES)]
    mt.upload_files(fns, S3BUCKET, dstprefix=DATAFNPREFIX % s_t0,
            test=True, verbose=10, acl=None)