Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit aba6369

Browse files
committed
Fixed failing checks
1 parent f82c7be commit aba6369

File tree

12 files changed

+112
-88
lines changed

12 files changed

+112
-88
lines changed

.github/workflows/cypress-end-to-end-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
browser: chrome
111111
project: ./mephisto/abstractions/blueprints/static_html_task/source
112112
config-file: ./cypress.config.js
113-
start: python ./examples/simple_static_task/static_test_script.py
113+
start: python ./examples/simple_static_task/run_task.py
114114
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
115115
headless: true
116116

docker/docker-compose.dev.vscode.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ services:
3030
/tmp/debugpy
3131
--wait-for-client
3232
--listen 0.0.0.0:5678
33-
/mephisto/examples/simple_static_task/static_test_script.py
33+
/mephisto/examples/simple_static_task/run_task.py
3434
",
3535
]

docs/web/docs/guides/how_to_use/efficiency_organization/docker.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Some users prefer to keep Mephisto entirely contained. Docker is one option for
1010

1111
```bash
1212
# Build the docker image and tag with name 'mephisto'
13-
$ docker build -t mephisto .
13+
$ docker build -t mephisto .
1414

1515
# By default, the container just runs `mephisto check`:
1616
$ docker run mephisto
1717
Mephisto seems to be set up correctly.
1818

1919
# You can also bind ports and pass in shell commands, e.g. to run
2020
# a task directly from the container
21-
$ docker run -p 3000:3000 mephisto bash -c 'cd mephisto/examples/simple_static_task && python static_test_script.py'
21+
$ docker run -p 3000:3000 mephisto bash -c 'cd mephisto/examples/simple_static_task && python run_task.py'
2222

2323
```
2424
By default, Mephisto run data will be stored at `/mephisto/data` within the container.

docs/web/docs/guides/tutorials/first_task.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To get started, you can launch a task by executing a run script. For instance, l
2020

2121
```bash
2222
$ cd examples/simple_static_task
23-
$ python static_test_script.py
23+
$ python run_task.py
2424
```
2525

2626
This will launch a local HTTP server with the task hosted, based on the default configuration options:
@@ -31,21 +31,21 @@ defaults:
3131
- /mephisto/architect: local
3232
- /mephisto/provider: mock
3333
```
34-
We'll dig into *how* this works [later](#33-default-abstraction-usage).
34+
We'll dig into *how* this works [later](#33-default-abstraction-usage).
3535
3636
### 1.2 Access the task
3737
3838
By default, the task should be hosted at `localhost:3000`. This default is set by the `LocalArchitect`, which is used based on the `- /mephisto/architect: local` line above. Navigating to this address should show you the preview view for the task.
3939

40-
Actually being able to access this task is done by providing `worker_id` and `assignment_id` URL params, like `localhost:3000/?worker_id=x&assignment_id=1` The `MockProvider` interprets these to be a test worker, which you can use to try out tasks.
40+
Actually being able to access this task is done by providing `worker_id` and `assignment_id` URL params, like `localhost:3000/?worker_id=x&assignment_id=1` The `MockProvider` interprets these to be a test worker, which you can use to try out tasks.
4141

4242
Try navigating here and completing a task by selecting a value (no need to use the file upload). After hitting submit you'll note that the window alerts you to the data that was sent to the Mephisto backend.
4343

4444
To work on another task, you'll want to change the `assignment_id` in your url. This will let `Worker` "x" work on another task. Complete and submit this too.
4545

4646
If you try to work on another task, you'll note that the system states you've worked on the maximum number of tasks. On this task, this is because Mephisto has launched the same two tasks twice to attempt to get different workers to complete them, and as "x" you've already completed both tasks. More on this [later.](#unit-creation-explained)
4747

48-
If you change to another `worker_id`, however, you can complete two more tasks. Do this and the Mephisto process should shut down cleanly.
48+
If you change to another `worker_id`, however, you can complete two more tasks. Do this and the Mephisto process should shut down cleanly.
4949

5050

5151
### 1.3 Reviewing tasks
@@ -60,24 +60,24 @@ For your convenience, for the `html-static-task-example` task we've already prov
6060
$ python examine_results.py
6161
Do you want to (r)eview, or (e)xamine data? Default examine. Can put e <end> or e <start> <end> to choose how many to view
6262
>> r
63-
Input task name:
63+
Input task name:
6464
```
6565

6666
Here we can enter the default task name for this task, `html-static-task-example` to see the results. You can also leave the two qualifications blank, as we aren't dealing with these yet.
6767

6868
```
6969
Input task name: html-static-task-example
7070
If you'd like to soft-block workers, you'll need a block qualification. Leave blank otherwise.
71-
Enter block qualification:
71+
Enter block qualification:
7272
If you'd like to qualify high-quality workers, you'll need an approve qualification. Leave blank otherwise.
73-
Enter approve qualification:
73+
Enter approve qualification:
7474
Starting review with following params:
7575
Task name: html-static-task-example
7676
Blocking qualification: None
7777
Approve qualification: None
78-
Press enter to continue...
78+
Press enter to continue...
7979
```
80-
After pressing enter, you'll be able to take action on some of the incoming tasks. You can `(a)ccept, (r)eject, (p)ass` using `a`, `r`, or `p`, using the caps version to apply to all the `Unit`s for a specific worker. Passing is used for work you think was attempted legitimately, but may have not been done
80+
After pressing enter, you'll be able to take action on some of the incoming tasks. You can `(a)ccept, (r)eject, (p)ass` using `a`, `r`, or `p`, using the caps version to apply to all the `Unit`s for a specific worker. Passing is used for work you think was attempted legitimately, but may have not been done
8181
```
8282
Reviewing for worker x, (1/2), Previous (First time worker!) (total remaining: 4)
8383
-------------------
@@ -105,7 +105,7 @@ Mephisto configuration options can be inherited from a number of different locat
105105
```bash
106106
$ mephisto wut architect=local
107107
108-
Architect Arguments
108+
Architect Arguments
109109
╭────────────────────┬──────┬───────────┬──────────────────────────────┬─────────┬──────────╮
110110
│ dest │ type │ default │ help │ choices │ required │
111111
├────────────────────┼──────┼───────────┼──────────────────────────────┼─────────┼──────────┤
@@ -127,10 +127,10 @@ $ mephisto wut architect=local
127127
**For the blueprint:**
128128
```bash
129129
$ mephisto wut blueprint=static_task
130-
Tasks launched from static blueprints need a source html file to display to workers,
131-
as well as a csv containing values that will be inserted into templates in the html.
130+
Tasks launched from static blueprints need a source html file to display to workers,
131+
as well as a csv containing values that will be inserted into templates in the html.
132132

133-
Blueprint Arguments
133+
Blueprint Arguments
134134
╭───────────────────┬─────────┬────────────────────┬───────────────────┬─────────┬──────────╮
135135
│ dest │ type │ default │ help │ choices │ required │
136136
├───────────────────┼─────────┼────────────────────┼───────────────────┼─────────┼──────────┤
@@ -199,7 +199,7 @@ For our given example task, the values we are using for these options are availa
199199
200200
As a simple starting point, we can try launching the server on a different port. Right now the default is `3000`, but with the following command we can set that ourselves:
201201
```
202-
python static_test_script.py mephisto.architect.port=1234
202+
python run_task.py mephisto.architect.port=1234
203203
```
204204
205205
This should launch the same task, but now available on the port `1234` rather than `3000`.
@@ -237,7 +237,7 @@ mephisto:
237237
238238
Save this configuration file, and you're ready to launch again:
239239
```bash
240-
$ python static_test_script.py conf=my_config
240+
$ python run_task.py conf=my_config
241241
```
242242
You'll note that Mephisto launches the task under your new task name:
243243
```
@@ -282,7 +282,7 @@ mephisto:
282282
```
283283
Save this configuration file, and you're ready to see your task live:
284284
```bash
285-
$ python static_test_script.py conf=my_config
285+
$ python run_task.py conf=my_config
286286
```
287287
Mephisto should print out a link to view your task on the mturk sandbox, like `https://workersandbox.mturk.com/mturk/preview?groupId=XXXXXXXXXXXXXXXX`. Navigate here and you're working on the same task, available on MTurk (on the sandbox at least)!
288288
@@ -292,13 +292,13 @@ Complete this task, and you can review it in the same way as before.
292292
293293
## 3. Task breakdown
294294
295-
Now that you've gotten a task running, this section gives a quick overview on some of the components in the configs and `static_test_script.py` that led to the observed behaviors. The goal is to ensure you can write your own run files by the end of the tutorial sections.
295+
Now that you've gotten a task running, this section gives a quick overview on some of the components in the configs and `run_task.py` that led to the observed behaviors. The goal is to ensure you can write your own run files by the end of the tutorial sections.
296296
297297
### 3.1 Config registration
298-
Mephisto wires up to configuration using standard Hydra syntax, but with both `yaml` files (for ease of writing) _and_ structured configs (for ease of documentation).
298+
Mephisto wires up to configuration using standard Hydra syntax, but with both `yaml` files (for ease of writing) _and_ structured configs (for ease of documentation).
299299
Here's the config we've set up for this example:
300300
```python
301-
# static_test_script.py
301+
# run_task.py
302302
from mephisto.abstractions.blueprints.static_html_task.static_html_blueprint import (
303303
BLUEPRINT_TYPE_STATIC_HTML,
304304
)
@@ -312,7 +312,7 @@ This is all you really *need* to launch a Mephisto task! The `@task_script` deco
312312
313313
Of course, there's quite a bit of 'magic' happening underneath the hood thanks to the script utilities. This version is explicit to show where you may add customization, and re-ordered for understanding:
314314
```python
315-
# modified static_test_script.py
315+
# modified run_task.py
316316
from mephisto.abstractions.blueprints.static_html_task.static_html_blueprint import (
317317
BLUEPRINT_TYPE_STATIC_HTML,
318318
)

examples/simple_static_task/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ python run_task.py
1515
and can additionally be launched with an onboarding step by specifying an onboarding qualification:
1616

1717
```console
18-
python static_run_with_onboarding.py
18+
python run_task_with_onboarding.py
1919
```
2020

2121
## Submit button customization
22-
### Hide the submit button
22+
### Hide the submit button
2323
Writing the markup below in `demo_task.html` will allow you to hide the submit button.
2424

2525
```html
@@ -44,10 +44,10 @@ python run_task.py
4444
```
4545
This will run the task.
4646

47-
Then go into the `mephisto/abstractions/blueprints/static_html_task/source` and run
47+
Then go into the `mephisto/abstractions/blueprints/static_html_task/source` and run
4848
```console
4949
npm run test
50-
```
50+
```
5151
to open cypress.
5252

5353
Select the Chrome browser and click on the one spec that shows up to run the tests.

examples/simple_static_task/run_task_ec2_prolific.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def main(operator, cfg: DictConfig) -> None:
2020

2121
# Mephisto qualifications
2222
shared_state.qualifications = [
23-
make_qualification_dict('sample_qual_name', QUAL_GREATER_EQUAL, 1),
23+
make_qualification_dict("sample_qual_name", QUAL_GREATER_EQUAL, 1),
2424
]
2525

2626
# Prolific qualifications

mephisto/abstractions/providers/prolific/README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ Shared state handles both custom and Prolific-supported qualifications:
3030
```python
3131
shared_state.prolific_specific_qualifications = [
3232
{
33-
'name': 'AgeRangeEligibilityRequirement',
34-
'min_age': 18,
35-
'max_age': 100,
33+
"name": "AgeRangeEligibilityRequirement",
34+
"min_age": 18,
35+
"max_age": 100,
3636
},
3737
]
3838

3939
shared_state.qualifications = [
40-
make_qualification_dict('sample_qual_name', QUAL_GREATER_EQUAL, 1),
40+
make_qualification_dict("sample_qual_name", QUAL_GREATER_EQUAL, 1),
4141
]
4242
```
4343

@@ -48,7 +48,7 @@ under the key `prolific_eligibility_requirements` like so:
4848
mephisto:
4949
provider:
5050
prolific_eligibility_requirements:
51-
- name: 'AgeRangeEligibilityRequirement'
51+
- name: "AgeRangeEligibilityRequirement"
5252
min_age: 10
5353
max_age: 20
5454
```
@@ -63,35 +63,35 @@ List of supported Eligibility Requirements for `SharedState.prolific_specific_qu
6363
```python
6464
[
6565
{
66-
'name': 'AgeRangeEligibilityRequirement',
67-
'min_age': '<value>',
68-
'max_age': '<value>',
66+
"name": "AgeRangeEligibilityRequirement",
67+
"min_age": "<value>",
68+
"max_age": "<value>",
6969
},
7070
{
71-
'name': 'ApprovalNumbersEligibilityRequirement',
72-
'minimum_approvals': '<value>',
73-
'maximum_approvals': '<value>',
71+
"name": "ApprovalNumbersEligibilityRequirement",
72+
"minimum_approvals": "<value>",
73+
"maximum_approvals": "<value>",
7474
},
7575
{
76-
'name': 'ApprovalRateEligibilityRequirement',
77-
'minimum_approval_rate': '<value>',
78-
'maximum_approval_rate': '<value>',
76+
"name": "ApprovalRateEligibilityRequirement",
77+
"minimum_approval_rate": "<value>",
78+
"maximum_approval_rate": "<value>",
7979
},
8080
{
81-
'name': 'CustomBlacklistEligibilityRequirement',
82-
'black_list': '<value>',
81+
"name": "CustomBlacklistEligibilityRequirement",
82+
"black_list": "<value>",
8383
},
8484
{
85-
'name': 'CustomWhitelistEligibilityRequirement',
86-
'white_list': '<value>',
85+
"name": "CustomWhitelistEligibilityRequirement",
86+
"white_list": "<value>",
8787
},
8888
{
89-
'name': 'JoinedBeforeEligibilityRequirement',
90-
'joined_before': '<value>',
89+
"name": "JoinedBeforeEligibilityRequirement",
90+
"joined_before": "<value>",
9191
},
9292
{
93-
'name': 'ParticipantGroupEligibilityRequirement',
94-
'id': '<value>',
93+
"name": "ParticipantGroupEligibilityRequirement",
94+
"id": "<value>",
9595
},
9696
]
9797
```

mephisto/client/review_app/client/src/pages/TaskPage/ModalForm/ModalForm.tsx

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -300,38 +300,39 @@ function ModalForm(props: ModalFormProps) {
300300

301301
<hr />
302302

303-
{BONUS_FOR_WORKER_ENABLED && props.data.form.checkboxGiveBonus !== undefined && (
304-
<>
305-
<Form.Check
306-
type={"checkbox"}
307-
label={"Give Bonus"}
308-
id={"giveBonus"}
309-
checked={props.data.form.checkboxGiveBonus}
310-
onChange={() =>
311-
onChangeGiveBonus(!props.data.form.checkboxGiveBonus)
312-
}
313-
/>
314-
315-
{props.data.form.checkboxGiveBonus && (
316-
<Row className={"second-line"}>
317-
<Col xs={4}>
318-
<Form.Control
319-
size={"sm"}
320-
type={"input"}
321-
placeholder={"Bonus"}
322-
value={props.data.form.bonus || ""}
323-
onChange={(e) => onChangeBonus(e.target.value)}
324-
/>
325-
</Col>
326-
<Col>
327-
<span>Amount (cents)</span>
328-
</Col>
329-
</Row>
330-
)}
303+
{BONUS_FOR_WORKER_ENABLED &&
304+
props.data.form.checkboxGiveBonus !== undefined && (
305+
<>
306+
<Form.Check
307+
type={"checkbox"}
308+
label={"Give Bonus"}
309+
id={"giveBonus"}
310+
checked={props.data.form.checkboxGiveBonus}
311+
onChange={() =>
312+
onChangeGiveBonus(!props.data.form.checkboxGiveBonus)
313+
}
314+
/>
315+
316+
{props.data.form.checkboxGiveBonus && (
317+
<Row className={"second-line"}>
318+
<Col xs={4}>
319+
<Form.Control
320+
size={"sm"}
321+
type={"input"}
322+
placeholder={"Bonus"}
323+
value={props.data.form.bonus || ""}
324+
onChange={(e) => onChangeBonus(e.target.value)}
325+
/>
326+
</Col>
327+
<Col>
328+
<span>Amount (cents)</span>
329+
</Col>
330+
</Row>
331+
)}
331332

332-
<hr />
333-
</>
334-
)}
333+
<hr />
334+
</>
335+
)}
335336

336337
{props.data.form.checkboxBanWorker !== undefined && (
337338
<>
@@ -351,7 +352,9 @@ function ModalForm(props: ModalFormProps) {
351352

352353
<Form.Check
353354
type={"checkbox"}
354-
label={FEEDBACK_FOR_WORKER_ENABLED ? "Write Note" : "Write Note for Yourself"}
355+
label={
356+
FEEDBACK_FOR_WORKER_ENABLED ? "Write Note" : "Write Note for Yourself"
357+
}
355358
id={"reviewNote"}
356359
checked={props.data.form.checkboxReviewNote}
357360
onChange={() =>
@@ -380,7 +383,9 @@ function ModalForm(props: ModalFormProps) {
380383
id={"reviewNoteSend"}
381384
checked={props.data.form.checkboxReviewNoteSend}
382385
onChange={() =>
383-
onChangeWriteReviewNoteSend(!props.data.form.checkboxReviewNoteSend)
386+
onChangeWriteReviewNoteSend(
387+
!props.data.form.checkboxReviewNoteSend
388+
)
384389
}
385390
/>
386391
</Col>

mephisto/client/review_app/client/src/pages/TasksPage/TasksPage.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ function TasksPage(props: PropsType) {
5757
}
5858
};
5959

60-
exportTaskResults(taskId, onSuccessExportResults, setLoadingExportResults, onError);
60+
exportTaskResults(
61+
taskId,
62+
onSuccessExportResults,
63+
setLoadingExportResults,
64+
onError
65+
);
6166
};
6267

6368
useEffect(() => {

0 commit comments

Comments
 (0)