Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fractalis
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
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
Code review analytics
Insights
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
Fractalis
fractalis
Commits
557dcb4c
There was a problem fetching the pipeline mini graph.
Commit
557dcb4c
authored
7 years ago
by
Sascha Herzinger
Browse files
Options
Downloads
Patches
Plain Diff
Added some documentation
parent
994c7135
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fractalis/analytics/task.py
+35
-7
35 additions, 7 deletions
fractalis/analytics/task.py
fractalis/data/etls/ada/handler_ada.py
+1
-1
1 addition, 1 deletion
fractalis/data/etls/ada/handler_ada.py
tests/test_session.py
+2
-0
2 additions, 0 deletions
tests/test_session.py
with
38 additions
and
8 deletions
fractalis/analytics/task.py
+
35
−
7
View file @
557dcb4c
"""
This module provides AnalyticTask, which is a modification of a standard
Celery task tailored to Fractalis.
"""
import
abc
import
json
import
re
import
logging
import
time
from
typing
import
List
import
pandas
as
pd
from
celery
import
Task
...
...
@@ -14,25 +16,45 @@ logger = logging.getLogger(__name__)
class
AnalyticTask
(
Task
,
metaclass
=
abc
.
ABCMeta
):
"""
AnalyticTask is a tailored Celery Task that enforces a certain pattern
for all Fractalis analytic tasks and provides certain functionality like
the parsing of the arguments before submitting it to celery.
"""
@property
@abc.abstractmethod
def
name
(
self
):
def
name
(
self
)
->
str
:
"""
The name of the task.
"""
pass
@staticmethod
def
factory
(
task_name
):
def
factory
(
task_name
:
str
)
->
'
AnalyticTask
'
:
"""
Initialize the correct task based on the given arguments.
:param task_name: The name of the task to initialize.
:return: An initialized child of this class.
"""
from
.
import
TASK_REGISTRY
for
task
in
TASK_REGISTRY
:
if
task
.
name
==
task_name
:
return
task
()
@abc.abstractmethod
def
main
(
self
):
def
main
(
self
)
->
dict
:
"""
Since we hijack run(), we need a new entry point for every task.
This method is called by our modified run method with all parsed
arguments.
:return A dict containing the results of the task.
"""
pass
@staticmethod
def
prepare_args
(
data_tasks
,
args
):
def
prepare_args
(
data_tasks
:
List
[
str
],
args
:
dict
)
->
dict
:
"""
Replace data task ids in the arguments with their associated
data frame located on the file system.
:param data_tasks: We use this list to check access.
:param args: The arguments submitted to run()
:return: The new parsed arguments
"""
arguments
=
{}
for
arg
in
args
:
value
=
args
[
arg
]
...
...
@@ -63,7 +85,13 @@ class AnalyticTask(Task, metaclass=abc.ABCMeta):
arguments
[
arg
]
=
value
return
arguments
def
run
(
self
,
data_tasks
,
args
):
def
run
(
self
,
data_tasks
:
List
[
str
],
args
:
dict
)
->
str
:
"""
This is called by the celery worker. This method calls other helper
methods to prepare and validate the in and output of a task.
:param data_tasks: List of data task ids from session to check access.
:param args: This is the dict of arguments submitted to the task.
:return: The result of the task.
"""
arguments
=
self
.
prepare_args
(
data_tasks
,
args
)
result
=
self
.
main
(
**
arguments
)
try
:
...
...
This diff is collapsed.
Click to expand it.
fractalis/data/etls/ada/handler_ada.py
+
1
−
1
View file @
557dcb4c
...
...
@@ -7,7 +7,7 @@ from fractalis.data.etlhandler import ETLHandler
class
AdaHandler
(
ETLHandler
):
"""
This ETLHandler provides integration with ADA.
'
Ada provides key infrastructure for secured integration, vi
z
ualization,
'
Ada provides key infrastructure for secured integration, vi
s
ualization,
and analysis of anonymized clinical and experimental data stored in CSV
and tranSMART format, or provided by RedCAP and Synapse apps.
'
...
...
This diff is collapsed.
Click to expand it.
tests/test_session.py
+
2
−
0
View file @
557dcb4c
"""
This module provides tests for the session interface of Fractalis.
"""
from
uuid
import
UUID
from
time
import
sleep
...
...
@@ -6,6 +7,7 @@ import flask
from
redis
import
StrictRedis
# noinspection PyMissingOrEmptyDocstring,PyMissingTypeHints
class
TestSession
(
object
):
@pytest.fixture
(
scope
=
'
module
'
)
...
...
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