Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101252785
worker_result.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Feb 7, 05:14
Size
1 KB
Mime Type
text/x-python
Expires
Sun, Feb 9, 05:14 (2 d)
Engine
blob
Format
Raw Data
Handle
24124069
Attached To
R3600 invenio-infoscience
worker_result.py
View Options
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
from
abc
import
abstractmethod
,
ABCMeta
from
six
import
add_metaclass
@add_metaclass
(
ABCMeta
)
class
AsynchronousResultWrapper
(
object
):
"""
This class is an abstract class. When you inherit it you should
absolutely implement all the functions.
This class is here for two reason, get and unified interface for all
the worker and so allow to switch from one to another seemslessly,
and also add feature to functions.
For example the get method now allow a post processing
on the result.
:param asynchronousresult: the async result that you want to wrap.
"""
def
__init__
(
self
,
asynchronousresult
):
self
.
asyncresult
=
asynchronousresult
@abstractmethod
def
get
(
self
,
postprocess
=
None
):
"""Return the value of the process."""
return
@abstractmethod
def
status
(
self
):
"""Return the current status of the tasks."""
return
def
uuid_to_workflow
(
uuid
):
"""Return the workflow associate to a specify uuid."""
from
invenio.modules.workflows.models
import
Workflow
return
Workflow
.
query
.
filter
(
Workflow
.
uuid
==
uuid
)
.
first
()
Event Timeline
Log In to Comment