Add option for live MT-ing

This commit is contained in:
Ruben van de Ven 2019-11-02 21:23:38 +01:00
parent 8971618982
commit a780818ef8
3 changed files with 72 additions and 4 deletions

View File

@ -21,6 +21,11 @@ if __name__ == '__main__':
action='store_true',
help='Skip attempt to connect to plotter'
)
argParser.add_argument(
'--for-real',
action='store_true',
help='Do not use sandbox'
)
argParser.add_argument(
'--verbose',
'-v',

View File

@ -47,6 +47,7 @@ class CentralManagement():
if args.no_plotter:
self.config['dummy_plotter'] = True
self.config['for_real'] = args.for_real
varDb = os.path.join(
# self.config['storage_dir'],
@ -67,15 +68,16 @@ class CentralManagement():
# M-turk connection
MTURK_SANDBOX = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'
MTURK_REAL = 'https://mturk-requester.us-east-1.amazonaws.com'
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/mturk.html#MTurk.Client
self.mturk = boto3.client('mturk',
aws_access_key_id = self.config['amazon']['user_id'],
aws_secret_access_key = self.config['amazon']['user_secret'],
region_name='us-east-1',
endpoint_url = MTURK_SANDBOX
endpoint_url = MTURK_REAL if self.config['for_real'] else MTURK_SANDBOX
)
self.logger.info(f"Mechanical turk: {self.mturk.get_account_balance()}")
self.logger.info(f"Mechanical turk account balance: {self.mturk.get_account_balance()['AvailableBalance']}")
self.sqs = SqsListener(self.config, self.eventQueue, self.isRunning)
sqsThread = threading.Thread(target=self.sqs.start, name='sqs')
@ -97,7 +99,7 @@ class CentralManagement():
#
#
self.eventQueue.put(Signal('start', {'ding':'test'}))
# self.eventQueue.put(Signal('start', {'ding':'test'}))
while self.isRunning.is_set():
time.sleep(.5)
@ -263,7 +265,10 @@ class CentralManagement():
)
self.logger.info(f"Created hit: {new_hit}")
self.logger.info("https://workersandbox.mturk.com/mturk/preview?groupId=" + new_hit['HIT']['HITGroupId'])
if not self.config['for_real']:
self.logger.info("https://workersandbox.mturk.com/mturk/preview?groupId=" + new_hit['HIT']['HITGroupId'])
else:
self.logger.info("https://worker.mturk.com/mturk/preview?groupId=" + new_hit['HIT']['HITGroupId'])
self.currentHit.hit_id = new_hit['HIT']['HITId']

58
www/basic_square.svg Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
viewBox="0 0 2450 1800"
width="245mm"
height="180mm"
preserveAspectRatio="none"
id="svg3"
sodipodi:docname="000139.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<metadata
id="metadata9">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs7" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="3836"
inkscape:window-height="2126"
id="namedview5"
showgrid="false"
inkscape:zoom="1.3875926"
inkscape:cx="311.32047"
inkscape:cy="589.76197"
inkscape:window-x="2"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg3" />
<rect
style="fill:none;fill-opacity:1;stroke:#808080;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.75590557;stroke-opacity:1"
id="rect819"
width="306.99152"
height="306.99152"
x="1287.0762"
y="638.77118" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB