Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rosetta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
ExaCT
Rosetta
Commits
d4776b81
Commit
d4776b81
authored
3 years ago
by
Stefano Alberto Russo
Browse files
Options
Downloads
Patches
Plain Diff
New demo data.
parent
f54f6fad
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/webapp/code/rosetta/core_app/management/commands/core_app_populate.py
+86
-59
86 additions, 59 deletions
...rosetta/core_app/management/commands/core_app_populate.py
with
86 additions
and
59 deletions
services/webapp/code/rosetta/core_app/management/commands/core_app_populate.py
+
86
−
59
View file @
d4776b81
...
@@ -7,16 +7,21 @@ class Command(BaseCommand):
...
@@ -7,16 +7,21 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
#=====================
# Admin
# Admin
#=====================
try
:
try
:
User
.
objects
.
get
(
username
=
'
admin
'
)
User
.
objects
.
get
(
username
=
'
admin
'
)
print
(
'
Not creating admin user as it already exist
'
)
print
(
'
Not creating admin user as it already exist
'
)
except
User
.
DoesNotExist
:
except
User
.
DoesNotExist
:
print
(
'
Creating admin user with default password
'
)
print
(
'
Creating admin user with default password
'
)
admin
=
User
.
objects
.
create_superuser
(
'
admin
'
,
'
admin@example.com
'
,
'
admin
'
)
admin
=
User
.
objects
.
create_superuser
(
'
admin
'
,
'
admin@example.com
'
,
'
admin
'
)
Profile
.
objects
.
create
(
user
=
admin
)
Profile
.
objects
.
create
(
user
=
admin
)
#=====================
# Testuser
# Testuser
#=====================
try
:
try
:
testuser
=
User
.
objects
.
get
(
username
=
'
testuser
'
)
testuser
=
User
.
objects
.
get
(
username
=
'
testuser
'
)
print
(
'
Not creating test user as it already exist
'
)
print
(
'
Not creating test user as it already exist
'
)
...
@@ -39,7 +44,9 @@ class Command(BaseCommand):
...
@@ -39,7 +44,9 @@ class Command(BaseCommand):
private_key_file
=
'
/rosetta/.ssh/id_rsa
'
,
private_key_file
=
'
/rosetta/.ssh/id_rsa
'
,
public_key_file
=
'
/rosetta/.ssh/id_rsa.pub
'
)
public_key_file
=
'
/rosetta/.ssh/id_rsa.pub
'
)
# Default homepage text
#=====================
# Default home text
#=====================
default_home_text_content
=
'''
default_home_text_content
=
'''
<div class=
"
span8 offset2
"
style=
"
margin: 30px auto; max-width:800px
"
>
<div class=
"
span8 offset2
"
style=
"
margin: 30px auto; max-width:800px
"
>
Welcome to Rosetta!
Welcome to Rosetta!
...
@@ -63,19 +70,22 @@ class Command(BaseCommand):
...
@@ -63,19 +70,22 @@ class Command(BaseCommand):
Text
.
objects
.
create
(
id
=
'
home
'
,
content
=
default_home_text_content
)
Text
.
objects
.
create
(
id
=
'
home
'
,
content
=
default_home_text_content
)
#=====================
# Platform containers
# Platform containers
#=====================
platform_containers
=
Container
.
objects
.
filter
(
user
=
None
)
platform_containers
=
Container
.
objects
.
filter
(
user
=
None
)
if
platform_containers
:
if
platform_containers
:
print
(
'
Not creating public containers as they already exist
'
)
print
(
'
Not creating public containers as they already exist
'
)
else
:
else
:
print
(
'
Creating platform containers...
'
)
print
(
'
Creating platform containers...
'
)
# Minimal
Meta
Desktop
Docker (sarusso repo)
# Minimal
Desktop
Container
.
objects
.
create
(
user
=
None
,
Container
.
objects
.
create
(
user
=
None
,
name
=
'
Minimal
Meta
Desktop
'
,
name
=
'
Minimal
Desktop
'
,
description
=
'
A minimal
meta-
desktop environment providing basic window management functionalities and a terminal.
'
,
description
=
'
A minimal desktop environment providing basic window management functionalities and a terminal.
'
,
registry
=
'
docker.io
'
,
registry
=
'
docker.io
'
,
image
=
'
sarusso/minimal
meta
desktop
'
,
image
=
'
sarusso/minimaldesktop
'
,
tag
=
'
v0.2.0
'
,
tag
=
'
v0.2.0
'
,
arch
=
'
x86_64
'
,
arch
=
'
x86_64
'
,
os
=
'
linux
'
,
os
=
'
linux
'
,
...
@@ -85,64 +95,87 @@ class Command(BaseCommand):
...
@@ -85,64 +95,87 @@ class Command(BaseCommand):
supports_custom_interface_port
=
True
,
supports_custom_interface_port
=
True
,
supports_interface_auth
=
True
)
supports_interface_auth
=
True
)
# # BasicMetaDesktop Docker (sarusso repo)
# Basic Desktop
# Container.objects.create(user = None,
Container
.
objects
.
create
(
user
=
None
,
# name = 'BasicMetaDesktop latest',
name
=
'
Basic Desktop
'
,
# image = 'sarusso/basicmetadesktop',
description
=
'
A basic desktop environment. Provides a terminal, a file manager, a web browser and other generic applications.
'
,
# registry = 'docker_hub',
registry
=
'
docker.io
'
,
# protocol = 'https',
image
=
'
sarusso/basicdesktop
'
,
# ports = '8590',
tag
=
'
v0.2.0
'
,
# supports_custom_interface_port = True,
arch
=
'
x86_64
'
,
# supports_user_auth = False,
os
=
'
linux
'
,
# supports_pass_auth = True)
interface_port
=
'
8590
'
,
#
interface_protocol
=
'
http
'
,
#
interface_transport
=
'
tcp/ip
'
,
# # DevMetaDesktop Docker (sarusso repo)
supports_custom_interface_port
=
True
,
# Container.objects.create(user = None,
supports_interface_auth
=
True
)
# name = 'DevMetaDesktop latest',
# image = 'sarusso/devmetadesktop',
# type = 'docker',
# registry = 'docker_hub',
# protocol = 'https',
# ports = '8590',
# supports_custom_interface_port = True,
# supports_user_auth = False,
# supports_pass_auth = True)
# Testuser containers
testuser_containers
=
Container
.
objects
.
filter
(
user
=
testuser
)
if
testuser_containers
:
print
(
'
Not creating testuser private containers as they already exist
'
)
else
:
print
(
'
Creating testuser private containers...
'
)
# Jupyter
Singularity
# Jupyter
Notebook
Container
.
objects
.
create
(
user
=
testuser
,
Container
.
objects
.
create
(
user
=
None
,
name
=
'
Jupyter Notebook
'
,
name
=
'
Jupyter Notebook
'
,
description
=
'
A
basic
Jupyter
n
otebook
environment.
'
,
description
=
'
A Jupyter
N
otebook
server
'
,
registry
=
'
docker.io
'
,
registry
=
'
docker.io
'
,
image
=
'
jupyter
/base-
notebook
'
,
image
=
'
sarusso/
jupyternotebook
'
,
tag
=
'
latest
'
,
tag
=
'
v0.2.0
'
,
arch
=
'
x86_64
'
,
arch
=
'
x86_64
'
,
os
=
'
linux
'
,
os
=
'
linux
'
,
interface_port
=
'
8888
'
,
interface_port
=
'
8888
'
,
interface_protocol
=
'
http
'
,
interface_protocol
=
'
http
'
,
interface_transport
=
'
tcp/ip
'
,
interface_transport
=
'
tcp/ip
'
,
supports_custom_interface_port
=
False
,
supports_custom_interface_port
=
True
,
supports_interface_auth
=
False
)
supports_interface_auth
=
True
)
# Jupyter Notebook
Container
.
objects
.
create
(
user
=
None
,
name
=
'
SSH server
'
,
description
=
'
A SSH server supporting X forwarding as well.
'
,
registry
=
'
docker.io
'
,
image
=
'
sarusso/ssh
'
,
tag
=
'
v0.2.0
'
,
arch
=
'
x86_64
'
,
os
=
'
linux
'
,
interface_port
=
'
22
'
,
interface_protocol
=
'
http
'
,
interface_transport
=
'
tcp/ip
'
,
supports_custom_interface_port
=
True
,
supports_interface_auth
=
True
)
#=====================
# Testuser containers
#=====================
#testuser_containers = Container.objects.filter(user=testuser)
#if testuser_containers:
# print('Not creating testuser private containers as they already exist')
#else:
# print('Creating testuser private containers...')
#
# # Jupyter Singularity
# Container.objects.create(user = testuser,
# name = 'Jupyter Notebook',
# description = 'The official Jupyter Notebook container.',
# registry = 'docker.io',
# image = 'jupyter/base-notebook',
# tag = 'latest',
# arch = 'x86_64',
# os = 'linux',
# interface_port = '8888',
# interface_protocol = 'http',
# interface_transport = 'tcp/ip',
# supports_custom_interface_port = False,
# supports_interface_auth = False)
#=====================
# Computing resources
# Computing resources
#=====================
computing_resources
=
Computing
.
objects
.
all
()
computing_resources
=
Computing
.
objects
.
all
()
if
computing_resources
:
if
computing_resources
:
print
(
'
Not creating demo computing resources as they already exist
'
)
print
(
'
Not creating demo computing resources as they already exist
'
)
else
:
else
:
print
(
'
Creating demo computing resources
containers
...
'
)
print
(
'
Creating demo computing resources...
'
)
#==============================
# Demo internal computing
# Demo Internal computing
#==============================
Computing
.
objects
.
create
(
user
=
None
,
Computing
.
objects
.
create
(
user
=
None
,
name
=
'
Demo Internal
'
,
name
=
'
Demo Internal
'
,
description
=
'
A demo internal computing resource.
'
,
description
=
'
A demo internal computing resource.
'
,
...
@@ -156,9 +189,7 @@ class Command(BaseCommand):
...
@@ -156,9 +189,7 @@ class Command(BaseCommand):
container_runtimes
=
'
docker
'
)
container_runtimes
=
'
docker
'
)
#==============================
# Demo standalone computing plus conf
# Demo Single Node computing
#==============================
demo_singlenode_computing
=
Computing
.
objects
.
create
(
user
=
None
,
demo_singlenode_computing
=
Computing
.
objects
.
create
(
user
=
None
,
name
=
'
Demo Standalone
'
,
name
=
'
Demo Standalone
'
,
description
=
'
A demo standalone computing resource.
'
,
description
=
'
A demo standalone computing resource.
'
,
...
@@ -180,9 +211,7 @@ class Command(BaseCommand):
...
@@ -180,9 +211,7 @@ class Command(BaseCommand):
data
=
{
'
user
'
:
'
slurmtestuser
'
})
data
=
{
'
user
'
:
'
slurmtestuser
'
})
#==============================
# Demo cluster computing plus conf
# Demo Cluster computing
#==============================
demo_slurm_computing
=
Computing
.
objects
.
create
(
user
=
None
,
demo_slurm_computing
=
Computing
.
objects
.
create
(
user
=
None
,
name
=
'
Demo Cluster
'
,
name
=
'
Demo Cluster
'
,
description
=
'
A demo cluster computing resource.
'
,
description
=
'
A demo cluster computing resource.
'
,
...
@@ -195,12 +224,10 @@ class Command(BaseCommand):
...
@@ -195,12 +224,10 @@ class Command(BaseCommand):
requires_user_keys
=
True
,
requires_user_keys
=
True
,
container_runtimes
=
'
singularity
'
)
container_runtimes
=
'
singularity
'
)
# Create demo slurm sys computing conf
ComputingSysConf
.
objects
.
create
(
computing
=
demo_slurm_computing
,
ComputingSysConf
.
objects
.
create
(
computing
=
demo_slurm_computing
,
data
=
{
'
host
'
:
'
slurmclustermaster-main
'
,
'
default_partition
'
:
'
partition1
'
,
data
=
{
'
host
'
:
'
slurmclustermaster-main
'
,
'
default_partition
'
:
'
partition1
'
,
'
binds
'
:
'
/shared/data/users:/shared/data/users,/shared/scratch:/shared/scratch
'
})
'
binds
'
:
'
/shared/data/users:/shared/data/users,/shared/scratch:/shared/scratch
'
})
# Create demo slurm user computing conf
ComputingUserConf
.
objects
.
create
(
user
=
testuser
,
ComputingUserConf
.
objects
.
create
(
user
=
testuser
,
computing
=
demo_slurm_computing
,
computing
=
demo_slurm_computing
,
data
=
{
'
user
'
:
'
slurmtestuser
'
})
data
=
{
'
user
'
:
'
slurmtestuser
'
})
...
...
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