Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Shakour
clowdflows
Commits
0d8117fb
Commit
0d8117fb
authored
Mar 17, 2014
by
Janez K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
53cbe3b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
workflows/models.py
workflows/models.py
+11
-16
workflows/tasks.py
workflows/tasks.py
+5
-1
No files found.
workflows/models.py
View file @
0d8117fb
...
@@ -15,7 +15,7 @@ from mothra.settings import USE_CONCURRENCY
...
@@ -15,7 +15,7 @@ from mothra.settings import USE_CONCURRENCY
if
USE_CONCURRENCY
:
if
USE_CONCURRENCY
:
from
workflows.tasks
import
runWidgetAsync
,
runForLoopIteration
from
workflows.tasks
import
runWidgetAsync
,
runForLoopIteration
from
workflows.tasks
import
executeWidgetFunction
,
executeWidgetProgressBar
,
executeWidgetStreaming
,
executeWidgetWithRequest
from
workflows.tasks
import
executeWidgetFunction
,
executeWidgetProgressBar
,
executeWidgetStreaming
,
executeWidgetWithRequest
,
runWidget
class
WidgetException
(
Exception
):
class
WidgetException
(
Exception
):
pass
pass
...
@@ -425,6 +425,13 @@ class Widget(models.Model):
...
@@ -425,6 +425,13 @@ class Widget(models.Model):
pass
pass
def
run
(
self
,
offline
):
def
run
(
self
,
offline
):
if
self
.
abstract_widget
.
windows_queue
:
t
=
runWidget
.
apply_async
([
self
,
offline
],
queue
=
"windows"
)
t
.
wait
()
else
:
self
.
proper_run
(
offline
)
def
proper_run
(
self
,
offline
):
if
not
self
.
ready_to_run
():
if
not
self
.
ready_to_run
():
raise
WidgetException
(
"The prerequisites for running this widget have not been met."
)
raise
WidgetException
(
"The prerequisites for running this widget have not been met."
)
self
.
running
=
True
self
.
running
=
True
...
@@ -457,23 +464,11 @@ class Widget(models.Model):
...
@@ -457,23 +464,11 @@ class Widget(models.Model):
input_dict
[
'wsdl'
]
=
self
.
abstract_widget
.
wsdl
input_dict
[
'wsdl'
]
=
self
.
abstract_widget
.
wsdl
input_dict
[
'wsdl_method'
]
=
self
.
abstract_widget
.
wsdl_method
input_dict
[
'wsdl_method'
]
=
self
.
abstract_widget
.
wsdl_method
if
self
.
abstract_widget
.
has_progress_bar
:
if
self
.
abstract_widget
.
has_progress_bar
:
if
self
.
abstract_widget
.
windows_queue
:
outputs
=
function_to_call
(
input_dict
,
self
)
t
=
executeWidgetProgressBar
.
apply_async
([
self
,
input_dict
],
queue
=
"windows"
)
outputs
=
t
.
wait
()
else
:
outputs
=
executeWidgetProgressBar
(
self
,
input_dict
)
elif
self
.
abstract_widget
.
is_streaming
:
elif
self
.
abstract_widget
.
is_streaming
:
if
self
.
abstract_widget
.
windows_queue
:
outputs
=
function_to_call
(
input_dict
,
self
,
None
)
t
=
executeWidgetStreaming
.
apply_async
([
self
,
input_dict
],
queue
=
"windows"
)
outputs
=
t
.
wait
()
else
:
outputs
=
executeWidgetStreaming
(
self
,
input_dict
)
else
:
else
:
if
self
.
abstract_widget
.
windows_queue
:
outputs
=
function_to_call
(
input_dict
)
t
=
executeWidgetFunction
.
apply_async
([
self
,
input_dict
],
queue
=
"windows"
)
outputs
=
t
.
wait
()
else
:
outputs
=
executeWidgetFunction
(
self
,
input_dict
)
else
:
else
:
if
self
.
workflow_link
.
is_for_loop
():
if
self
.
workflow_link
.
is_for_loop
():
self
.
workflow_link
.
run_for_loop
()
self
.
workflow_link
.
run_for_loop
()
...
...
workflows/tasks.py
View file @
0d8117fb
...
@@ -5,7 +5,6 @@ import workflows.library
...
@@ -5,7 +5,6 @@ import workflows.library
def
add
(
a
,
b
):
def
add
(
a
,
b
):
import
time
import
time
time
.
sleep
(
10
)
time
.
sleep
(
10
)
raise
Exception
(
"test"
)
return
a
+
b
return
a
+
b
@
task
()
@
task
()
...
@@ -32,6 +31,11 @@ def executeWidgetWithRequest(widget,input_dict,output_dict,request):
...
@@ -32,6 +31,11 @@ def executeWidgetWithRequest(widget,input_dict,output_dict,request):
function_to_call
=
getattr
(
workflows
.
library
,
widget
.
abstract_widget
.
action
)
function_to_call
=
getattr
(
workflows
.
library
,
widget
.
abstract_widget
.
action
)
return
function_to_call
(
request
,
input_dict
,
output_dict
)
return
function_to_call
(
request
,
input_dict
,
output_dict
)
@
task
()
def
runWidget
(
widget
,
offline
):
widget
.
proper_run
(
offline
)
@
task
()
@
task
()
def
runWidgetAsync
(
widget
):
def
runWidgetAsync
(
widget
):
widget
.
run
(
True
)
widget
.
run
(
True
)
\ No newline at end of file
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