bfabric-web-apps 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bfabric_web_apps/__init__.py +10 -50
- bfabric_web_apps/layouts/layouts.py +51 -2
- bfabric_web_apps/objects/BfabricInterface.py +4 -11
- bfabric_web_apps/utils/callbacks.py +65 -4
- bfabric_web_apps/utils/resource_utilities.py +86 -148
- {bfabric_web_apps-0.1.3.dist-info → bfabric_web_apps-0.1.4.dist-info}/METADATA +1 -1
- bfabric_web_apps-0.1.4.dist-info/RECORD +16 -0
- bfabric_web_apps-0.1.3.dist-info/RECORD +0 -16
- {bfabric_web_apps-0.1.3.dist-info → bfabric_web_apps-0.1.4.dist-info}/LICENSE +0 -0
- {bfabric_web_apps-0.1.3.dist-info → bfabric_web_apps-0.1.4.dist-info}/WHEEL +0 -0
bfabric_web_apps/__init__.py
CHANGED
@@ -16,11 +16,15 @@ from .utils.get_power_user_wrapper import get_power_user_wrapper
|
|
16
16
|
from .utils.create_app_in_bfabric import create_app_in_bfabric
|
17
17
|
|
18
18
|
# Export callbacks
|
19
|
-
from .utils.callbacks import
|
19
|
+
from .utils.callbacks import (
|
20
|
+
process_url_and_token,
|
21
|
+
submit_bug_report,
|
22
|
+
populate_workunit_details
|
23
|
+
)
|
20
24
|
|
21
25
|
from .utils import defaults
|
22
26
|
|
23
|
-
from bfabric_web_apps.utils.resource_utilities import create_workunit, create_resource
|
27
|
+
from bfabric_web_apps.utils.resource_utilities import create_workunit, create_resource, create_workunits, create_resources
|
24
28
|
HOST = os.getenv("HOST", defaults.HOST)
|
25
29
|
PORT = int(os.getenv("PORT", defaults.PORT)) # Convert to int since env variables are strings
|
26
30
|
DEV = os.getenv("DEV", str(defaults.DEV)).lower() in ["true", "1", "yes"] # Convert to bool
|
@@ -49,52 +53,8 @@ __all__ = [
|
|
49
53
|
'BUG_REPORT_EMAIL_ADDRESS',
|
50
54
|
'create_app_in_bfabric',
|
51
55
|
'create_workunit',
|
52
|
-
'create_resource'
|
56
|
+
'create_resource',
|
57
|
+
'create_workunits',
|
58
|
+
'create_resources',
|
59
|
+
'populate_workunit_details',
|
53
60
|
]
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
'''
|
58
|
-
import os
|
59
|
-
from .utils import defaults
|
60
|
-
|
61
|
-
# Private variable for CONFIG_FILE_PATH
|
62
|
-
_CONFIG_FILE_PATH = os.getenv("CONFIG_FILE_PATH", defaults.CONFIG_FILE_PATH)
|
63
|
-
|
64
|
-
def set_config_file_path(path):
|
65
|
-
"""
|
66
|
-
Setter for the CONFIG_FILE_PATH variable.
|
67
|
-
"""
|
68
|
-
global _CONFIG_FILE_PATH
|
69
|
-
if not isinstance(path, str):
|
70
|
-
raise ValueError("CONFIG_FILE_PATH must be a string.")
|
71
|
-
_CONFIG_FILE_PATH = path
|
72
|
-
|
73
|
-
def get_config_file_path():
|
74
|
-
"""
|
75
|
-
Getter for the CONFIG_FILE_PATH variable.
|
76
|
-
"""
|
77
|
-
return _CONFIG_FILE_PATH
|
78
|
-
|
79
|
-
# Expose CONFIG_FILE_PATH as a read-only property
|
80
|
-
class Config:
|
81
|
-
@property
|
82
|
-
def CONFIG_FILE_PATH(self):
|
83
|
-
return get_config_file_path()
|
84
|
-
|
85
|
-
config = Config()
|
86
|
-
|
87
|
-
'''
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
'''
|
92
|
-
from bfabric import config
|
93
|
-
|
94
|
-
config.CONFIG_FILE_PATH
|
95
|
-
'''
|
96
|
-
|
97
|
-
'''
|
98
|
-
from bfabric import set_config_file_path
|
99
|
-
set_config_file_path("new/path/to/config.json")
|
100
|
-
'''
|
@@ -144,8 +144,9 @@ def get_static_layout(base_title=None, main_content=None, documentation_content=
|
|
144
144
|
dbc.Tabs(
|
145
145
|
[
|
146
146
|
dbc.Tab(main_content, label="Main", tab_id="main"),
|
147
|
-
dbc.Tab(get_documentation_tab(documentation_content), label="Documentation", tab_id="documentation"),
|
148
|
-
dbc.Tab(
|
147
|
+
dbc.Tab(dcc.Loading(get_documentation_tab(documentation_content)), label="Documentation", tab_id="documentation"),
|
148
|
+
dbc.Tab(dcc.Loading(get_workunits_tab()), label="Workunits", tab_id="workunits"),
|
149
|
+
dbc.Tab(dcc.Loading(get_report_bug_tab()), label="Report a Bug", tab_id="report-bug"),
|
149
150
|
],
|
150
151
|
id="tabs",
|
151
152
|
active_tab="main",
|
@@ -250,6 +251,54 @@ def get_report_bug_tab():
|
|
250
251
|
"margin-left": "2vw",
|
251
252
|
"font-size": "20px",
|
252
253
|
"padding-right": "40px",
|
254
|
+
"overflow-y": "scroll",
|
255
|
+
"max-height": "65vh",
|
256
|
+
},
|
257
|
+
),
|
258
|
+
width=9,
|
259
|
+
),
|
260
|
+
],
|
261
|
+
style={"margin-top": "0px", "min-height": "40vh"},
|
262
|
+
)
|
263
|
+
|
264
|
+
|
265
|
+
def get_workunits_tab():
|
266
|
+
"""
|
267
|
+
Returns the content for the Workunits tab with the upgraded layout.
|
268
|
+
"""
|
269
|
+
return dbc.Row(
|
270
|
+
id="page-content-workunits",
|
271
|
+
children=[
|
272
|
+
dbc.Col(
|
273
|
+
html.Div(
|
274
|
+
id="sidebar_workunits",
|
275
|
+
children=[], # Optional: Add sidebar content here if needed
|
276
|
+
style={
|
277
|
+
"border-right": "2px solid #d4d7d9",
|
278
|
+
"height": "100%",
|
279
|
+
"padding": "20px",
|
280
|
+
"font-size": "20px",
|
281
|
+
},
|
282
|
+
),
|
283
|
+
width=3,
|
284
|
+
),
|
285
|
+
dbc.Col(
|
286
|
+
html.Div(
|
287
|
+
id="page-content-workunits-children",
|
288
|
+
children=[
|
289
|
+
html.H2("Workunits"),
|
290
|
+
html.Div(id="refresh-workunits", children=[]),
|
291
|
+
html.Div(
|
292
|
+
id="workunits-content"
|
293
|
+
)
|
294
|
+
],
|
295
|
+
style={
|
296
|
+
"margin-top": "2vh",
|
297
|
+
"margin-left": "2vw",
|
298
|
+
"font-size": "20px",
|
299
|
+
"padding-right": "40px",
|
300
|
+
"overflow-y": "scroll",
|
301
|
+
"max-height": "65vh",
|
253
302
|
},
|
254
303
|
),
|
255
304
|
width=9,
|
@@ -9,12 +9,9 @@ from bfabric_web_apps.utils.get_logger import get_logger
|
|
9
9
|
import os
|
10
10
|
import bfabric_web_apps
|
11
11
|
|
12
|
-
|
13
|
-
|
14
12
|
VALIDATION_URL = "https://fgcz-bfabric.uzh.ch/bfabric/rest/token/validate?token="
|
15
13
|
HOST = "fgcz-bfabric.uzh.ch"
|
16
14
|
|
17
|
-
|
18
15
|
class BfabricInterface( Bfabric ):
|
19
16
|
_instance = None # Singleton instance
|
20
17
|
_wrapper = None # Shared wrapper instance
|
@@ -50,8 +47,7 @@ class BfabricInterface( Bfabric ):
|
|
50
47
|
if self._wrapper is None:
|
51
48
|
raise RuntimeError("Bfabric wrapper is not initialized. Token validation must run first.")
|
52
49
|
return self._wrapper
|
53
|
-
|
54
|
-
|
50
|
+
|
55
51
|
|
56
52
|
def token_to_data(self, token):
|
57
53
|
"""
|
@@ -96,8 +92,6 @@ class BfabricInterface( Bfabric ):
|
|
96
92
|
|
97
93
|
environment_dict = {"Production":"https://fgcz-bfabric.uzh.ch/bfabric","Test":"https://fgcz-bfabric-test.uzh.ch/bfabric"}
|
98
94
|
|
99
|
-
print('userinfo', userinfo)
|
100
|
-
|
101
95
|
token_data = dict(
|
102
96
|
environment = userinfo['environment'],
|
103
97
|
user_data = userinfo['user'],
|
@@ -267,7 +261,7 @@ class BfabricInterface( Bfabric ):
|
|
267
261
|
|
268
262
|
# Extract App ID, Name, and Description
|
269
263
|
app_info = app_data_dict[0] # First (and only) result
|
270
|
-
|
264
|
+
|
271
265
|
json_data = json.dumps({
|
272
266
|
"id": app_info.get("id", "Unknown"),
|
273
267
|
"name": app_info.get("name", "Unknown"),
|
@@ -312,10 +306,9 @@ class BfabricInterface( Bfabric ):
|
|
312
306
|
os.system(mail)
|
313
307
|
|
314
308
|
return True
|
309
|
+
|
315
310
|
|
316
|
-
|
317
|
-
|
318
|
-
|
311
|
+
|
319
312
|
# Create a globally accessible instance
|
320
313
|
bfabric_interface = BfabricInterface()
|
321
314
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from dash import Input, Output, State, html, dcc
|
2
|
-
from bfabric_web_apps.objects.BfabricInterface import
|
2
|
+
from bfabric_web_apps.objects.BfabricInterface import bfabric_interface
|
3
3
|
import json
|
4
4
|
import dash_bootstrap_components as dbc
|
5
5
|
from datetime import datetime as dt
|
@@ -28,7 +28,6 @@ def process_url_and_token(url_params):
|
|
28
28
|
return None, None, None, None, base_title, None, None
|
29
29
|
|
30
30
|
token = "".join(url_params.split('token=')[1:])
|
31
|
-
bfabric_interface = BfabricInterface()
|
32
31
|
tdata_raw = bfabric_interface.token_to_data(token)
|
33
32
|
|
34
33
|
if tdata_raw:
|
@@ -88,7 +87,6 @@ def process_url_and_token(url_params):
|
|
88
87
|
return None, None, None, None, base_title, None, None
|
89
88
|
|
90
89
|
|
91
|
-
|
92
90
|
def submit_bug_report(n_clicks, bug_description, token, entity_data):
|
93
91
|
"""
|
94
92
|
Submits a bug report based on user input, token, and entity data.
|
@@ -103,7 +101,7 @@ def submit_bug_report(n_clicks, bug_description, token, entity_data):
|
|
103
101
|
tuple: A tuple containing two boolean values indicating success and failure status of the submission.
|
104
102
|
(is_open_success, is_open_failure)
|
105
103
|
"""
|
106
|
-
|
104
|
+
|
107
105
|
print("submit bug report", token)
|
108
106
|
|
109
107
|
# Parse token data if token is provided, otherwise set it to an empty dictionary
|
@@ -168,3 +166,66 @@ def submit_bug_report(n_clicks, bug_description, token, entity_data):
|
|
168
166
|
|
169
167
|
return False, False
|
170
168
|
|
169
|
+
|
170
|
+
def populate_workunit_details(token_data):
|
171
|
+
|
172
|
+
"""
|
173
|
+
Function to populate workunit data for the current app instance.
|
174
|
+
|
175
|
+
Args:
|
176
|
+
token_data (dict): Token metadata.
|
177
|
+
|
178
|
+
Returns:
|
179
|
+
html.Div: A div containing the populated workunit data.
|
180
|
+
"""
|
181
|
+
|
182
|
+
environment_urls = {
|
183
|
+
"Test": "https://fgcz-bfabric-test.uzh.ch/bfabric/workunit/show.html?id=",
|
184
|
+
"Prod": "https://fgcz-bfabric.uzh.ch/bfabric/workunit/show.html?id="
|
185
|
+
}
|
186
|
+
|
187
|
+
if token_data:
|
188
|
+
|
189
|
+
jobId = token_data.get('jobId', None)
|
190
|
+
print("jobId", jobId)
|
191
|
+
|
192
|
+
job = bfabric_interface.get_wrapper().read("job", {"id": jobId})[0]
|
193
|
+
workunits = job.get("workunit", [])
|
194
|
+
|
195
|
+
if workunits:
|
196
|
+
wus = bfabric_interface.get_wrapper().read(
|
197
|
+
"workunit",
|
198
|
+
{"id": [wu["id"] for wu in workunits]}
|
199
|
+
)
|
200
|
+
else:
|
201
|
+
return html.Div(
|
202
|
+
[
|
203
|
+
html.P("No workunits found for the current job.")
|
204
|
+
]
|
205
|
+
)
|
206
|
+
|
207
|
+
wu_cards = []
|
208
|
+
|
209
|
+
for wu in wus:
|
210
|
+
print(wu)
|
211
|
+
wu_card = html.A(
|
212
|
+
dbc.Card([
|
213
|
+
dbc.CardHeader(html.B(f"Workunit {wu['id']}")),
|
214
|
+
dbc.CardBody([
|
215
|
+
html.P(f"Name: {wu.get('name', 'n/a')}"),
|
216
|
+
html.P(f"Description: {wu.get('description', 'n/a')}"),
|
217
|
+
html.P(f"Num Resources: {len(wu.get('resource', []))}"),
|
218
|
+
html.P(f"Created: {wu.get('created', 'n/a')}"),
|
219
|
+
html.P(f"Status: {wu.get('status', 'n/a')}")
|
220
|
+
])
|
221
|
+
], style={"width": "400px", "margin":"10px"}),
|
222
|
+
href=environment_urls[token_data.get("environment", "Test")] + str(wu["id"]),
|
223
|
+
target="_blank",
|
224
|
+
style={"text-decoration": "none"}
|
225
|
+
)
|
226
|
+
|
227
|
+
wu_cards.append(wu_card)
|
228
|
+
|
229
|
+
return dbc.Container(wu_cards, style={"display": "flex", "flex-wrap": "wrap"})
|
230
|
+
else:
|
231
|
+
return html.Div()
|
@@ -4,64 +4,94 @@ from bfabric_web_apps.utils.get_power_user_wrapper import get_power_user_wrapper
|
|
4
4
|
from bfabric_scripts.bfabric_upload_resource import bfabric_upload_resource
|
5
5
|
from pathlib import Path
|
6
6
|
|
7
|
-
def create_workunit(token_data, application_name, application_description, application_id,
|
7
|
+
def create_workunit(token_data, application_name, application_description, application_id, container_id):
|
8
8
|
"""
|
9
|
-
Create a
|
9
|
+
Create a single workunit in B-Fabric.
|
10
10
|
|
11
11
|
Args:
|
12
12
|
token_data (dict): Authentication token data.
|
13
13
|
application_name (str): Name of the application.
|
14
14
|
application_description (str): Description of the application.
|
15
15
|
application_id (int): Application ID.
|
16
|
-
|
16
|
+
container_id (int): Container ID (Order ID).
|
17
17
|
|
18
18
|
Returns:
|
19
|
-
|
19
|
+
int: Created workunit ID or None if creation fails.
|
20
20
|
"""
|
21
21
|
L = get_logger(token_data)
|
22
22
|
wrapper = bfabric_interface.get_wrapper()
|
23
|
-
workunit_ids = []
|
24
23
|
|
25
|
-
|
24
|
+
workunit_data = {
|
25
|
+
"name": f"{application_name} - Order {container_id}",
|
26
|
+
"description": f"{application_description} for Order {container_id}",
|
27
|
+
"applicationid": int(application_id),
|
28
|
+
"containerid": container_id,
|
29
|
+
}
|
30
|
+
|
31
|
+
try:
|
32
|
+
workunit_response = L.logthis(
|
33
|
+
api_call=wrapper.save,
|
34
|
+
endpoint="workunit",
|
35
|
+
obj=workunit_data,
|
36
|
+
params=None,
|
37
|
+
flush_logs=True
|
38
|
+
)
|
39
|
+
workunit_id = workunit_response[0].get("id")
|
40
|
+
print(f"Created Workunit ID: {workunit_id} for Order ID: {container_id}")
|
41
|
+
|
42
|
+
# First we get the existing workunit_ids for the current job object:
|
43
|
+
pre_existing_workunit_ids = [elt.get("id") for elt in wrapper.read("job", {"id": token_data.get("jobId")})[0].get("workunit", [])]
|
44
|
+
|
45
|
+
# Now we associate the job object with the workunits
|
46
|
+
job = L.logthis(
|
47
|
+
api_call=L.power_user_wrapper.save,
|
48
|
+
endpoint="job",
|
49
|
+
obj={"id": token_data.get("jobId"), "workunitid": [workunit_id] + pre_existing_workunit_ids},
|
50
|
+
params=None,
|
51
|
+
flush_logs=True
|
52
|
+
)
|
53
|
+
return workunit_id
|
54
|
+
|
55
|
+
except Exception as e:
|
56
|
+
L.log_operation(
|
57
|
+
"Error",
|
58
|
+
f"Failed to create workunit for Order {container_id}: {e}",
|
59
|
+
params=None,
|
60
|
+
flush_logs=True,
|
61
|
+
)
|
62
|
+
print(f"Failed to create workunit for Order {container_id}: {e}")
|
63
|
+
return None
|
64
|
+
|
65
|
+
|
66
|
+
def create_workunits(token_data, application_name, application_description, application_id, container_ids):
|
67
|
+
"""
|
68
|
+
Create multiple workunits in B-Fabric.
|
69
|
+
|
70
|
+
Args:
|
71
|
+
token_data (dict): Authentication token data.
|
72
|
+
application_name (str): Name of the application.
|
73
|
+
application_description (str): Description of the application.
|
74
|
+
application_id (int): Application ID.
|
75
|
+
container_ids (list): List of container IDs.
|
76
|
+
|
77
|
+
Returns:
|
78
|
+
list: List of created workunit IDs.
|
79
|
+
"""
|
26
80
|
if not isinstance(container_ids, list):
|
27
|
-
container_ids = [container_ids] #
|
28
|
-
|
29
|
-
for container_id in container_ids:
|
30
|
-
workunit_data = {
|
31
|
-
"name": f"{application_name} - Order {container_id}",
|
32
|
-
"description": f"{application_description} for Order {container_id}",
|
33
|
-
"applicationid": int(application_id),
|
34
|
-
"containerid": container_id, # Assigning order ID dynamically
|
35
|
-
}
|
36
|
-
|
37
|
-
try:
|
38
|
-
workunit_response = L.logthis(
|
39
|
-
api_call=wrapper.save,
|
40
|
-
endpoint="workunit",
|
41
|
-
obj=workunit_data,
|
42
|
-
params=None,
|
43
|
-
flush_logs=True
|
44
|
-
)
|
45
|
-
workunit_id = workunit_response[0].get("id")
|
46
|
-
print(f"Created Workunit ID: {workunit_id} for Order ID: {container_id}")
|
47
|
-
workunit_ids.append(workunit_id)
|
81
|
+
container_ids = [container_ids] # Ensure it's a list
|
48
82
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
params=None,
|
54
|
-
flush_logs=True,
|
55
|
-
)
|
56
|
-
print(f"Failed to create workunit for Order {container_id}: {e}")
|
83
|
+
workunit_ids = [
|
84
|
+
create_workunit(token_data, application_name, application_description, application_id, container_id)
|
85
|
+
for container_id in container_ids
|
86
|
+
]
|
57
87
|
|
58
|
-
return workunit_ids
|
88
|
+
return [wu_id for wu_id in workunit_ids if wu_id is not None] # Filter out None values
|
59
89
|
|
60
90
|
|
61
91
|
def create_resource(token_data, workunit_id, gz_file_path):
|
62
92
|
"""
|
63
|
-
Upload a .gz resource to an existing B-Fabric workunit.
|
64
|
-
|
93
|
+
Upload a single .gz resource to an existing B-Fabric workunit.
|
94
|
+
|
65
95
|
Args:
|
66
96
|
token_data (dict): Authentication token data.
|
67
97
|
workunit_id (int): ID of the workunit to associate the resource with.
|
@@ -76,8 +106,8 @@ def create_resource(token_data, workunit_id, gz_file_path):
|
|
76
106
|
try:
|
77
107
|
file_path = Path(gz_file_path)
|
78
108
|
|
79
|
-
#
|
80
|
-
print("
|
109
|
+
# Upload the resource
|
110
|
+
print("Uploading:", file_path, "to workunit:", workunit_id)
|
81
111
|
result = bfabric_upload_resource(wrapper, file_path, workunit_id)
|
82
112
|
|
83
113
|
if result:
|
@@ -103,116 +133,24 @@ def create_resource(token_data, workunit_id, gz_file_path):
|
|
103
133
|
return None
|
104
134
|
|
105
135
|
|
106
|
-
|
107
|
-
'''
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
# Upload a resource to the created workunit
|
112
|
-
resource_name = "example_resource.txt"
|
113
|
-
resource_content = b"This is an example resource content."
|
114
|
-
|
115
|
-
try:
|
116
|
-
resource_response = bfabric.upload_resource(
|
117
|
-
resource_name=resource_name,
|
118
|
-
content=resource_content,
|
119
|
-
workunit_id=workunit_id
|
120
|
-
)
|
121
|
-
print(f"Resource '{resource_name}' uploaded successfully.")
|
122
|
-
except Exception as e:
|
123
|
-
print(f"Failed to upload resource: {e}")
|
124
|
-
exit(1)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
import subprocess
|
135
|
-
from zeep import Client
|
136
|
-
import os
|
137
|
-
from bfabric_web_apps.utils.get_logger import get_logger
|
138
|
-
|
139
|
-
BFABRIC_WORKUNIT_WSDL = "https://fgcz-bfabric-test.uzh.ch:443/bfabric/workunit?wsdl"
|
140
|
-
BFABRIC_RESOURCE_WSDL = "https://fgcz-bfabric-test.uzh.ch:443/bfabric/resource?wsdl"
|
141
|
-
|
142
|
-
def run_pipeline_and_register_in_bfabric(run_name: str, output_dir: str):
|
136
|
+
def create_resources(token_data, workunit_id, gz_file_paths):
|
143
137
|
"""
|
144
|
-
|
138
|
+
Upload multiple .gz resources to an existing B-Fabric workunit.
|
139
|
+
|
140
|
+
Args:
|
141
|
+
token_data (dict): Authentication token data.
|
142
|
+
workunit_id (int): ID of the workunit to associate the resources with.
|
143
|
+
gz_file_paths (list): List of full paths to .gz files to upload.
|
145
144
|
|
146
|
-
:
|
147
|
-
|
145
|
+
Returns:
|
146
|
+
list: List of successfully uploaded resource IDs.
|
148
147
|
"""
|
149
|
-
|
150
|
-
|
151
|
-
# Nextflow Pipeline starten
|
152
|
-
process = subprocess.run([
|
153
|
-
"nextflow", "run", "nf-core/bclconvert",
|
154
|
-
"-profile", "docker",
|
155
|
-
"--outdir", output_dir,
|
156
|
-
"-resume"
|
157
|
-
], capture_output=True, text=True)
|
158
|
-
|
159
|
-
if process.returncode != 0:
|
160
|
-
print(f"[ERROR] Nextflow Pipeline fehlgeschlagen: {process.stderr}")
|
161
|
-
return False
|
162
|
-
|
163
|
-
print(f"[INFO] Pipeline abgeschlossen. Ergebnisse werden registriert...")
|
164
|
-
|
165
|
-
# Workunit in B-Fabric anlegen
|
166
|
-
workunit_id = create_bfabric_workunit(run_name)
|
167
|
-
|
168
|
-
# Falls Workunit erfolgreich erstellt, dann Ressourcen speichern
|
169
|
-
if workunit_id:
|
170
|
-
register_fastq_files_in_bfabric(output_dir, workunit_id)
|
171
|
-
else:
|
172
|
-
print("[ERROR] Konnte Workunit nicht in B-Fabric registrieren!")
|
173
|
-
|
174
|
-
return True
|
148
|
+
if not isinstance(gz_file_paths, list):
|
149
|
+
gz_file_paths = [gz_file_paths] # Ensure it's a list
|
175
150
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
workunit_data = {
|
181
|
-
"name": run_name,
|
182
|
-
"description": "Illumina BCL zu FASTQ Konvertierung",
|
183
|
-
"status": "Completed"
|
184
|
-
}
|
185
|
-
L = get_logger({})
|
186
|
-
response = L.logthis(
|
187
|
-
api_call=client.service.createWorkunit,
|
188
|
-
obj=workunit_data
|
189
|
-
)[0]
|
190
|
-
print(f"[INFO] Workunit erstellt mit ID: {response}")
|
191
|
-
return response
|
192
|
-
except Exception as e:
|
193
|
-
print(f"[ERROR] Fehler beim Erstellen der Workunit: {e}")
|
194
|
-
return None
|
151
|
+
resource_ids = [
|
152
|
+
create_resource(token_data, workunit_id, gz_file_path)
|
153
|
+
for gz_file_path in gz_file_paths
|
154
|
+
]
|
195
155
|
|
196
|
-
|
197
|
-
"""Registriert alle FASTQ-Dateien aus dem Output-Verzeichnis in B-Fabric."""
|
198
|
-
try:
|
199
|
-
client = Client(BFABRIC_RESOURCE_WSDL)
|
200
|
-
L = get_logger({})
|
201
|
-
for file_name in os.listdir(output_dir):
|
202
|
-
if file_name.endswith(".fastq.gz"):
|
203
|
-
file_path = os.path.join(output_dir, file_name)
|
204
|
-
resource_data = {
|
205
|
-
"name": file_name,
|
206
|
-
"description": "Erzeugt von nf-core/bclconvert",
|
207
|
-
"path": file_path,
|
208
|
-
"type": "FASTQ",
|
209
|
-
"workunitId": workunit_id
|
210
|
-
}
|
211
|
-
response = L.logthis(
|
212
|
-
api_call=client.service.createResource,
|
213
|
-
obj=resource_data
|
214
|
-
)[0]
|
215
|
-
print(f"[INFO] Ressource gespeichert mit ID: {response}")
|
216
|
-
except Exception as e:
|
217
|
-
print(f"[ERROR] Fehler beim Registrieren der Ressourcen: {e}")
|
218
|
-
'''
|
156
|
+
return [res_id for res_id in resource_ids if res_id is not None] # Filter out None values
|
@@ -0,0 +1,16 @@
|
|
1
|
+
bfabric_web_apps/__init__.py,sha256=jU5o22wl7kXHNJVCH6aqW0llZLfxeQssCIeX1OerQfI,1790
|
2
|
+
bfabric_web_apps/layouts/layouts.py,sha256=fmv_QTJeAmiOxreAwx14QojzyRV_8RHu1c4sCPN5r5U,13382
|
3
|
+
bfabric_web_apps/objects/BfabricInterface.py,sha256=wmcL9JuSC0QEopgImvkZxmtCIS7izt6bwb6y_ch0zus,10178
|
4
|
+
bfabric_web_apps/objects/Logger.py,sha256=62LC94xhm7YG5LUw3yH46NqvJQsAX7wnc9D4zbY16rA,5224
|
5
|
+
bfabric_web_apps/utils/app_init.py,sha256=RCdpCXp19cF74bouYJLPe-KSETZ0Vwqtd02Ta2VXEF8,428
|
6
|
+
bfabric_web_apps/utils/callbacks.py,sha256=XbRMK2sL55twtR6IWGAf5B1m2fnMTOpkhyR55-76nes,8444
|
7
|
+
bfabric_web_apps/utils/components.py,sha256=V7ECGmF2XYy5O9ciDJVH1nofJYP2a_ELQF3z3X_ADbo,844
|
8
|
+
bfabric_web_apps/utils/create_app_in_bfabric.py,sha256=eVk3cQDXxW-yo9b9n_zzGO6kLg_SLxYbIDECyvEPJXU,2752
|
9
|
+
bfabric_web_apps/utils/defaults.py,sha256=B82j3JEbysLEU9JDZgoDBTX7WGvW3Hn5YMZaWAcjZew,278
|
10
|
+
bfabric_web_apps/utils/get_logger.py,sha256=0Y3SrXW93--eglS0_ZOc34NOriAt6buFPik5n0ltzRA,434
|
11
|
+
bfabric_web_apps/utils/get_power_user_wrapper.py,sha256=T33z64XjmJ0KSlmfEmrEP8eYpbpINCVD6Xld_V7PR2g,1027
|
12
|
+
bfabric_web_apps/utils/resource_utilities.py,sha256=q0gC_Lr5GQlMBU0_gLm48zjq3XlXbT4QArqzJcmxrTo,5476
|
13
|
+
bfabric_web_apps-0.1.4.dist-info/LICENSE,sha256=k0O_i2k13i9e35aO-j7FerJafAqzzu8x0kkBs0OWF3c,1065
|
14
|
+
bfabric_web_apps-0.1.4.dist-info/METADATA,sha256=5TKRMRQB4an34gV7b4_hValbQEvuLvOmJpB9DsKBFR4,480
|
15
|
+
bfabric_web_apps-0.1.4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
16
|
+
bfabric_web_apps-0.1.4.dist-info/RECORD,,
|
@@ -1,16 +0,0 @@
|
|
1
|
-
bfabric_web_apps/__init__.py,sha256=xqh-kddXaV4xblnMcDA73bTuy3zn5viucueuuIx41HM,2495
|
2
|
-
bfabric_web_apps/layouts/layouts.py,sha256=XoSLcQPcgMBhQz2VfxkUzNL23FLBXFRFvbCL2mNLfnk,11636
|
3
|
-
bfabric_web_apps/objects/BfabricInterface.py,sha256=YC6VimARZfG2t90TK5xhQDsNzgMNljwqbCOT8Qz_Uhs,10247
|
4
|
-
bfabric_web_apps/objects/Logger.py,sha256=62LC94xhm7YG5LUw3yH46NqvJQsAX7wnc9D4zbY16rA,5224
|
5
|
-
bfabric_web_apps/utils/app_init.py,sha256=RCdpCXp19cF74bouYJLPe-KSETZ0Vwqtd02Ta2VXEF8,428
|
6
|
-
bfabric_web_apps/utils/callbacks.py,sha256=PiP1ZJ-QxdrOAZ-Mt-MN-g9wJLSOoLkWkXwPq_TLqDI,6472
|
7
|
-
bfabric_web_apps/utils/components.py,sha256=V7ECGmF2XYy5O9ciDJVH1nofJYP2a_ELQF3z3X_ADbo,844
|
8
|
-
bfabric_web_apps/utils/create_app_in_bfabric.py,sha256=eVk3cQDXxW-yo9b9n_zzGO6kLg_SLxYbIDECyvEPJXU,2752
|
9
|
-
bfabric_web_apps/utils/defaults.py,sha256=B82j3JEbysLEU9JDZgoDBTX7WGvW3Hn5YMZaWAcjZew,278
|
10
|
-
bfabric_web_apps/utils/get_logger.py,sha256=0Y3SrXW93--eglS0_ZOc34NOriAt6buFPik5n0ltzRA,434
|
11
|
-
bfabric_web_apps/utils/get_power_user_wrapper.py,sha256=T33z64XjmJ0KSlmfEmrEP8eYpbpINCVD6Xld_V7PR2g,1027
|
12
|
-
bfabric_web_apps/utils/resource_utilities.py,sha256=AVaqIXEfmCdWZfXDt32QfkZ9ChTL8D8cm1lCHXfT4Nc,7317
|
13
|
-
bfabric_web_apps-0.1.3.dist-info/LICENSE,sha256=k0O_i2k13i9e35aO-j7FerJafAqzzu8x0kkBs0OWF3c,1065
|
14
|
-
bfabric_web_apps-0.1.3.dist-info/METADATA,sha256=gTd86dYPrHKfypKFPry0SKjYtydW1z17fA-tSxz8vuM,480
|
15
|
-
bfabric_web_apps-0.1.3.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
16
|
-
bfabric_web_apps-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|