Commit babda304 authored by Roque's avatar Roque

backup playground scripts

parent 4d7e0dcd
import time
selenium_SR_url = "~/srv/project/slapos/software/seleniumserver/software.cfg"
instance = request(selenium_SR_url, "seleniumserver")
done = False
nap = 10
while not done:
print("instance started?")
if instance.getState() != 'started':
print("instance NOT started")
time.sleep(nap)
continue
print("instance started!")
print("instance ready?")
try:
instance.getConnectionParameter('url')
except:
print("instance NOT ready")
time.sleep(nap)
continue
print("instance ready!")
done = True
server_url = instance.getConnectionParameter('url')
print("server_url:")
print(server_url)
# get a specific parameter info
instance.getConnectionParameter('url')
# 'https://selenium:jvT0SRR9Mtad@[2001:67c:1254:5f:d58a::5933]:9443/wd/hub'
instance.getConnectionParameter('connection-parameters')
# ?? ERROR, not found
slapos service list
#{
# "seleniumserver": "~/srv/project/slapos/software/seleniumserver/software.cfg"
#}
slapos service info seleniumserver
# dict with all info
\ No newline at end of file
import time
from slapos import slap
NUMBER_OF_SERVERS = 2
selenium_SR_url = "~/srv/project/slapos/software/seleniumserver/software.cfg"
#TODO how to get SR url?
selenium_SR_url = "/srv/slapgrid/slappart70/srv/project/slapos/software/headlesschrome-seleniumserver/software.cfg"
print("REQUESTING SERVER INSTANCES")
my_slap = slap.slap()
#TODO how to get master_url?
my_slap.initializeConnection('http://10.0.222.95:4000') #slapgrid_uri – uri the slapgrid server connector
instance_list = []
for i in range(NUMBER_OF_SERVERS):
instance = my_slap.registerOpenOrder().request(selenium_SR_url, "headlesschrome-seleniumserver-" + str(i))
instance_list.append(instance)
print("instance requested: %s" % instance.getId())
done = False
nap = 300
while not done:
done = True
for instance in instance_list:
print("checking instance in %s" % instance.getId())
print("instance started?")
if instance.getState() != 'started':
print("instance NOT started")
time.sleep(nap)
done = False
continue
print("instance started!")
print("instance ready?")
try:
instance.getConnectionParameter('frontend-url')
except:
print("instance NOT ready")
time.sleep(nap)
done = False
continue
print("instance in %s ready!" % instance.getId())
print("all instances ready")
server_url_list = []
print("Server urls:")
for instance in instance_list:
# get a specific parameter info
server_url = instance.getConnectionParameter('frontend-url')
server_url_list.append(server_url)
print(server_url_list)
from slapos import slap
selenium_SR_url = "~/srv/project/slapos/software/headlesschrome-seleniumserver/software.cfg"
my_slap = slap.slap()
my_slap.initializeConnection('https://panel.rapid.space/') #config['master_url'] #doc: slapgrid_uri – uri the slapgrid server connector
# Slapos Master Url: EMPTY (the process uses https://slap.vifib.com/ by default)
# https://panel.rapid.space/ is probably better
computer = my_slap.registerComputer('slaprunner') #config['computer_id'] #doc: computer_guid – the identifier of the computer inside the slapgrid server. #slaprunner?
computer.getComputerPartitionList()
#my_slap.registerSupply().supply(path, computer_guid=config['computer_id'])
my_slap.registerOpenOrder().request( #code: request(self, software_release, partition_reference ...
path, # SR path
partition_reference='my_instance')
my_slap.registerOpenOrder().request(selenium_SR_url, 'my_selenium_server')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment