Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sams-hub-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
coding-at-fu
sams-hub-creator
Commits
813940cf
Commit
813940cf
authored
7 years ago
by
Sebastian Lobinger
Browse files
Options
Downloads
Patches
Plain Diff
initial commit
parent
09669027
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+42
-0
42 additions, 0 deletions
README.md
__init__.py
+2
-7
2 additions, 7 deletions
__init__.py
with
44 additions
and
7 deletions
README.md
0 → 100644
+
42
−
0
View file @
813940cf
# sams-hub-creator
Modul zum einfachen erstellen eines samsHUB basierend auf einer vorgegebenen
Verzeichnisstruktur unf Konfigurationsdateien im YAML-Format.
## Verwendung
Man kann das modul als python package z.B. in folgender Struktur Verwenden:
```
projekt
+-- config
| +-- config.yaml
+-- sams_hub_creator
| +-- __init__.py
| ...
+-- app_package
| +-- __init__.py
| ...
+-- app.py
```
Dabei liegt diesen Projekt im Verzeichnis
`sams_hub_creator`
.
Ein amsHub Objektlässt sich in der app.py dann sehr einfach Erzeugen:
```
python
import
sams_hub_creator
hub
=
sams_hub_creator
.
create
(
conf_part_hub
=
'
my_hub
'
)
```
In diesem Fall muss in der config.yaml der key für die hub konfiguration 'my_hub'
lauten. Die namen der apps, die der hub einbinden soll müssen in der config unter
'apps' stehen. Eine Config für die oben genannte Struktur könnte also so aussehen:
```
yaml
zib_hub
:
default_language
:
de
main_app
:
'
app_package'
apps
:
-
name
:
'
app_package'
```
## Verweise
Zu den möglichkeiten der samsHub Konfiguration siehe
[
sams-classes
](
https://git.imp.fu-berlin.de/coding-at-fu/sams-classes
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
__init__.py
+
2
−
7
View file @
813940cf
...
...
@@ -2,7 +2,7 @@ import yaml, os, glob
from
sams_classes
import
SAMSHub
,
SAMSApp
from
flask
import
Flask
def
create
_hub
(
conf_part_hub
,
conf_part_apps
=
'
apps
'
,
def
create
(
conf_part_hub
,
conf_part_apps
=
'
apps
'
,
config_file_path
=
'
config/config.yaml
'
,
dir_apps
=
'
.
'
):
with
open
(
config_file_path
,
'
r
'
)
as
f
:
hubConf
=
yaml
.
load
(
f
.
read
())
...
...
@@ -33,8 +33,3 @@ def search_yaml_files(path, exts = ['.yaml', '.yml']):
if
os
.
path
.
isfile
(
path
):
matchingFiles
.
append
(
path
)
return
matchingFiles
if
__name__
==
'
__main__
'
:
create_hub
()
else
:
hub
=
create_hub
()
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