Skip to content

Conversation

@mizzao
Copy link
Member

@mizzao mizzao commented Nov 4, 2019

cc @ejolly.

Copy link
Member Author

@mizzao mizzao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ejolly this uses the https://github.com/peerlibrary/meteor-aws-sdk package (@mitar does good work) to call AWS instead of the old janky stuff. It still needs a bunch of work though, see comments.

I could use your help to go through and modify all the TurkServer.mturk() calls appropriately and test them. That should allow you to run your existing experiment.

The lack of TypeScript means we have to basically check and test everything manually instead of getting the data shape checked for us.

admin/admin.js Outdated
TurkServer.checkAdmin();
try {
return TurkServer.mturk("GetAccountBalance", {});
return TurkServer.mturk.getAccountBalanceSync().AvailableBalance;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every Turkserver.mturk in the codebase now needs to be replaced with this direct JavaScript function variant instead. Note in particular that peerlibrary:aws-sdk conveniently provides a ...Sync() variant of the function that works with Meteor's fibers, so the call looks synchronous (even though it is in fact a callback under the hood).

switch (op) {
case "CreateHIT":
return JSPath.apply("..HITId[0]", result);
case "GetAccountBalance":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old AWS SDK used to be all XML-based, which means we have this ugly parser stuff. We can remove all that now and access the JSON data directly, but note that this will have to be added to each TurkServer.mturk call as in the example code above.

@mizzao mizzao marked this pull request as ready for review November 14, 2019 16:33
@mizzao
Copy link
Member Author

mizzao commented Nov 14, 2019

@ejolly see your question at peerlibrary/meteor-aws-sdk#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants