Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loom
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Vander Aa
loom
Commits
16a74eb6
Commit
16a74eb6
authored
8 years ago
by
Ada Böhm
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Labelling of py_task
parent
9ca5c43e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/loom/client/tasks.py
+9
-2
9 additions, 2 deletions
python/loom/client/tasks.py
tests/client/py_test.py
+3
-3
3 additions, 3 deletions
tests/client/py_test.py
with
12 additions
and
5 deletions
python/loom/client/tasks.py
+
9
−
2
View file @
16a74eb6
...
...
@@ -168,8 +168,15 @@ def py_call(obj, inputs=(), request=cpu1):
return
task
def
py_task
():
def
py_task
(
label
=
None
):
def
make_py_call
(
fn
):
def
py_task_builder
(
*
args
):
task
=
py_call
(
fn
,
args
)
if
label
is
not
None
:
task
.
label
=
label
else
:
task
.
label
=
fn
.
__name__
return
task
assert
callable
(
fn
)
return
lambda
*
args
:
py_call
(
fn
,
args
)
return
py_task_builder
return
make_py_call
This diff is collapsed.
Click to expand it.
tests/client/py_test.py
+
3
−
3
View file @
16a74eb6
...
...
@@ -21,7 +21,7 @@ def test_py_call(loom_env):
d
=
tasks
.
const
(
"
12345
"
)
p
=
tasks
.
py_call
(
f
,
(
c
,
d
))
q
=
tasks
.
py_call
(
g
)
result1
,
result2
=
loom_env
.
submit
((
p
,
q
)
,
"
report
"
)
result1
,
result2
=
loom_env
.
submit
((
p
,
q
))
assert
result1
==
b
"
ABC, 3, 12345, 5
"
assert
result2
==
b
"
Test
"
...
...
@@ -33,7 +33,7 @@ def test_py_task(loom_env):
def
t1
():
return
"
ABC
"
@tasks.py_task
()
@tasks.py_task
(
label
=
"
Merging task
"
)
def
t2
(
a
,
b
):
return
a
.
read
()
+
b
.
read
()
...
...
@@ -41,7 +41,7 @@ def test_py_task(loom_env):
a
=
tasks
.
const
(
"
1234
"
)
b
=
t1
()
c
=
t2
(
a
,
b
)
result
=
loom_env
.
submit
(
c
)
result
=
loom_env
.
submit
(
c
,
"
report
"
)
assert
result
==
b
"
1234ABC
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment