Tasks Table
tasks/tasks.py¶
TasksDB ¶
TasksDB(dburi='localhost/tm_admin')
Bases: DBSupport
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dburi |
str
|
The URI string for the database connection. |
'localhost/tm_admin'
|
Returns:
Type | Description |
---|---|
TasksDB
|
An instance of this class. |
Source code in tm_admin/tasks/tasks.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
mergeAnnotations
async
¶
mergeAnnotations(inpg)
Merge the task_annotation table from Tasking Manager into TM Admin. This table doesn't actually appear to be currently used by TM at all.
Source code in tm_admin/tasks/tasks.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
mergeAuxTables
async
¶
mergeAuxTables(inuri, outuri)
Merge more tables from TM into the unified tasks table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inuri |
str
|
The input database |
required |
outuri |
str
|
The output database |
required |
Source code in tm_admin/tasks/tasks.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
mergeHistory
async
¶
mergeHistory(inpg)
A method to merge the contents of the TM campaign_projects into the campaigns table as an array.
Source code in tm_admin/tasks/tasks.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
mergeInvalidations
async
¶
mergeInvalidations(inpg)
A method to merge the contents of the TM campaign_projects into the campaigns table as an array.
Source code in tm_admin/tasks/tasks.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
updateThread
async
¶
updateThread(queries, db)
Thread to handle importing data
Parameters:
Name | Type | Description | Default |
---|---|---|---|
queries |
list
|
The list of SQL queries to execute |
required |
db |
PostgresClient
|
A database connection |
required |
Source code in tm_admin/tasks/tasks.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
main
async
¶
main()
This main function lets this class be run standalone by a bash script.
Source code in tm_admin/tasks/tasks.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
|
options: show_source: false heading_level: 3
tasks/tasks_class.py¶
options: show_source: false heading_level: 3
tasks/api.py¶
TasksAPI ¶
TasksAPI()
Bases: PGSupport
Returns:
Type | Description |
---|---|
TasksAPI
|
An instance of this class |
Source code in tm_admin/tasks/api.py
62 63 64 65 66 67 68 69 70 71 72 |
|
initialize
async
¶
initialize(inuri)
Connect to all tables for API endpoints that require accessing multiple tables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inuri |
str
|
The URI for the TM Admin output database |
required |
Source code in tm_admin/tasks/api.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
getStatus
async
¶
getStatus(task_id, project_id)
Get the current status for a task using it's project and task IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id |
int
|
The task to lock |
required |
project_id |
int
|
The team to get the data for |
required |
Returns:
Type | Description |
---|---|
dict
|
the project information |
Source code in tm_admin/tasks/api.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
getByID
async
¶
getByID(task_id, project_id)
Get all the information for a task using it's project and task IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id |
int
|
The task to lock |
required |
project_id |
int
|
The team to get the data for |
required |
Returns:
Type | Description |
---|---|
dict
|
the project information |
Source code in tm_admin/tasks/api.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
getByUser
async
¶
getByUser(user_id, task_id, project_id)
Get all the information for a project using it's ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
int
|
The user ID to lock |
required |
task_id |
int
|
The task to lock |
required |
project_id |
int
|
The project this task is part of |
required |
Returns:
Type | Description |
---|---|
dict
|
the task information |
Source code in tm_admin/tasks/api.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
changeAction
async
¶
changeAction(user_id, task_id, project_id, action)
Manage the status of a task. This would be locking or unlocking, validation status, etc...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
int
|
The mapper locking the task |
required |
task_id |
int
|
The task to lock |
required |
project_id |
int
|
The project containing the task |
required |
action |
Taskaction
|
The action to change to |
required |
Returns:
Type | Description |
---|---|
bool
|
Whether the change was sucessful |
Source code in tm_admin/tasks/api.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
lockTask
async
¶
lockTask(task_id, project_id, user_id)
Lock a task to a mapper
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
int
|
The user ID to lock |
required |
task_id |
int
|
The task to update |
required |
project_id |
int
|
The project this task is in |
required |
Returns:
Type | Description |
---|---|
Mappingnotallowed
|
If locking was sucessful or not |
Source code in tm_admin/tasks/api.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
updateHistory
async
¶
updateHistory(history, task_id, project_id)
Update the task history column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
history |
list
|
The task history to update |
required |
task_id |
int
|
The task to update |
required |
project_id |
int
|
The project this task is in |
required |
Returns:
Type | Description |
---|---|
bool
|
If it worked |
Source code in tm_admin/tasks/api.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
appendHistory
async
¶
appendHistory(history, task_id, project_id)
Update the task history column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
history |
list
|
The task history to update |
required |
task_id |
int
|
The task to update |
required |
project_id |
int
|
The project this task is in |
required |
Returns:
Type | Description |
---|---|
bool
|
If it worked |
Source code in tm_admin/tasks/api.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
|
updateIssues
async
¶
updateIssues(issues, task_id, project_id)
Update the task history column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
issues |
list
|
The issues for this task |
required |
task_id |
int
|
The task to update |
required |
project_id |
int
|
The project this task is in |
required |
Returns:
Type | Description |
---|---|
bool
|
If it worked |
Source code in tm_admin/tasks/api.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
markAllMapped
async
¶
markAllMapped()
Args:
Returns:
Source code in tm_admin/tasks/api.py
352 353 354 355 356 357 358 359 360 361 362 |
|
resetBadImagery
async
¶
resetBadImagery()
Args:
Returns:
Source code in tm_admin/tasks/api.py
364 365 366 367 368 369 370 371 372 373 374 |
|
undoMapping
async
¶
undoMapping()
Args:
Returns:
Source code in tm_admin/tasks/api.py
376 377 378 379 380 381 382 383 384 385 386 |
|
main
async
¶
main()
This main function lets this class be run standalone by a bash script.
Source code in tm_admin/tasks/api.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
|
options: show_source: false heading_level: 3