Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DA-Platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
文档服务地址:
http://47.92.0.57:3000/
周报索引地址:
http://47.92.0.57:3000/s/NruNXRYmV
Open sidebar
Berlin
DA-Platform
Commits
cc055be4
Commit
cc055be4
authored
Jul 29, 2020
by
李景熙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加判断任务是否完成的函数
parent
15c64a70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
Task.py
DAPlatform/dao/Task.py
+16
-9
No files found.
DAPlatform/dao/Task.py
View file @
cc055be4
...
@@ -151,15 +151,16 @@ def find_task_completed(executor, start, num):
...
@@ -151,15 +151,16 @@ def find_task_completed(executor, start, num):
list
=
[]
list
=
[]
while
index
+
start
<
len
(
find
)
and
index
<
num
:
while
index
+
start
<
len
(
find
)
and
index
<
num
:
user
=
User
.
get_username
(
find
[
index
+
start
]
.
publish_id
)
user
=
User
.
get_username
(
find
[
index
+
start
]
.
publish_id
)
list
.
append
(
if
judge_completed
(
find
[
index
+
start
]
.
task_id
,
executor
)
==
1
:
{
list
.
append
(
'id'
:
find
[
index
+
start
]
.
task_id
,
{
'creator'
:
user
,
'id'
:
find
[
index
+
start
]
.
task_id
,
'creator_id'
:
find
[
index
+
start
]
.
publish_id
,
'creator'
:
user
,
'name'
:
find
[
index
+
start
]
.
task_name
,
'creator_id'
:
find
[
index
+
start
]
.
publish_id
,
'date'
:
find
[
index
+
start
]
.
publish_time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
'name'
:
find
[
index
+
start
]
.
task_name
,
}
'date'
:
find
[
index
+
start
]
.
publish_time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
)
}
)
index
+=
1
index
+=
1
except
:
except
:
return
Result
(
0
,
"find failed"
,
{},
0
)
return
Result
(
0
,
"find failed"
,
{},
0
)
...
@@ -167,6 +168,12 @@ def find_task_completed(executor, start, num):
...
@@ -167,6 +168,12 @@ def find_task_completed(executor, start, num):
return
Result
(
1
,
"find success"
,
list
,
math
.
ceil
(
len
(
find
)
/
num
))
return
Result
(
1
,
"find success"
,
list
,
math
.
ceil
(
len
(
find
)
/
num
))
#判断任务是否已完成(查找任务下的所有分片,对每个分片都判断已完成文件的数量,然后与分片下文件总数对比,如果相等,则视为分片完成,
# 如果所有分片都完成则任务视为完成,返回1,否则返回0)
def
judge_completed
(
taskid
,
user_id
):
# 寻找标注者选择的任务(从Relation表中找到用户id标注的分片,再利用分片表获取任务列表)
# 寻找标注者选择的任务(从Relation表中找到用户id标注的分片,再利用分片表获取任务列表)
def
find_task_my_task
(
executor
,
start
,
num
):
def
find_task_my_task
(
executor
,
start
,
num
):
try
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment