/
task_distribution_function.py
54 lines (43 loc) · 2.09 KB
/
task_distribution_function.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
__all__ = ['TaskDistributionFunction']
from enum import unique
from typing import List
from .primitives.base import BaseTolokaObject
from ..util._codegen import attribute
from ..util._extendable_enum import ExtendableStrEnum
class TaskDistributionFunction(BaseTolokaObject):
"""Issue of tasks with uneven frequency
Can be used for:
- Distribution of tasks with majority opinion verification.
- Issuing control tasks with uneven frequency. Allows you to change the frequency of verification as the user completes tasks.
- Issuing training tasks with uneven frequency. Allows you to change the frequency of training tasks as the user completes tasks.
Attributes:
scope: How to count tasks completed by the user:
* POOL - Count completed pool tasks.
* PROJECT - Count completed project tasks.
distribution: Distribution of tasks within an interval. Parameter has only one possible:
value - UNIFORM.
window_days: Period in which completed tasks are counted (number of days).
intervals: Interval borders and number of tasks in an interval.
"""
@unique
class Scope(ExtendableStrEnum):
PROJECT = 'PROJECT'
POOL = 'POOL'
@unique
class Distribution(ExtendableStrEnum):
UNIFORM = 'UNIFORM'
class Interval(BaseTolokaObject):
"""Interval borders and number of tasks in an interval
Attributes:
from_: Start of the interval (number of task completed by the user in the project or in the pool).
to: End of the interval (number of task completed by the user in the project or in the pool).
frequency: Frequency of tasks in an interval. The first task in an interval is a distributed task.
For example, if you set frequency: 3 tasks number 1, 4, 7 and so on will be distributed tasks.
"""
from_: int = attribute(origin='from')
to: int
frequency: int
scope: Scope = attribute(autocast=True)
distribution: Distribution = attribute(autocast=True)
window_days: int
intervals: List[Interval]