Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

PMT Frontend webapp #1252

Merged
merged 3 commits into from
Oct 26, 2018
Merged

PMT Frontend webapp #1252

merged 3 commits into from
Oct 26, 2018

Conversation

JackUrb
Copy link
Contributor

@JackUrb JackUrb commented Oct 25, 2018

This PR lays the groundwork for the frontend webapp that will eventually be used to test UIs, launch tasks, manage qualifications, review work, manage workers, and more.

Right now it hooks up to the DB that is created when using the optional use_db flag. It can be used by running npm install; npm run dev; python server.py from inside the webapp directory.

Current features:
Provides views into runs and workers (currently it acts as a passive way to view metadata about runs).

Next up I'll be adding the reviewer interface, which will follow a change to how PMT stores data.

Copy link
Contributor

@emilydinan emilydinan left a comment

Choose a reason for hiding this comment

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

awesome!!

@@ -443,6 +470,16 @@ def get_worker_assignment_pairing(self, worker_id, assignment_id):
results = c.fetchone()
return results

def get_all_run_data(self, start=0, count=30):
'''get all the run data for all task_group_ids.'''
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: for all of our docstrings elsewhere we use double quotation marks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, good catch. Fixing!

except Exception:
req = {}

# self.render(
Copy link
Contributor

Choose a reason for hiding this comment

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

left in by accident?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup - fixed

'level name or int (example: 20)')
FLAGS = parser.parse_args()

try:
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm pretty sure a call to _checkLevel already typechecks for you, so you can just always call that (and you don't neeed this try/except block

Copy link
Contributor

@klshuster klshuster left a comment

Choose a reason for hiding this comment

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

all looks great to me, just some minor comments

parlai/mturk/core/mturk_data_handler.py Show resolved Hide resolved
getColumnValue(header_name, item) {
switch(header_name) {
case 'run_id': return item.run_id;
case 'run_status': return 'complete';
Copy link
Contributor

Choose a reason for hiding this comment

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

so run_status is always complete for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should put a TODO here - I haven't been able to write the part that actually computes this value for a HIT yet

def ensure_dir_exists(path):
"""Make sure the parent dir exists for path so we can write a file."""
try:
os.makedirs(os.path.dirname(path))
Copy link
Contributor

Choose a reason for hiding this comment

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

are you going for os.makedirs(os.path.dirname(path), exists_ok=True)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that works a lot better than this. Thanks for the note!

results = self.data_handler.get_all_worker_data()
processed_results = []
for res in results:
processed_results.append(dict(zip(res.keys(), res)))
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you could use your row_to_dict function from above for res

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants