Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
vktrrdk committed Aug 31, 2020
2 parents d46da52 + 1fe2158 commit ab17c36
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 50 deletions.
1 change: 1 addition & 0 deletions .env.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CLOUD_CLIENT_TAG=
BIBIGRID_TAG=
CLIENT_PORT=
FORC_API_KEY=
ELASTIC_USER=
Expand Down
56 changes: 14 additions & 42 deletions VirtualMachineService/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ class VirtualMachineHandler(Iface):
def keyboard_interrupt_handler_playbooks(self):
global active_playbooks
for k, v in active_playbooks.items():
LOG.info(
"Clearing traces of Playbook-VM for (openstack_id): {0}".format(k)
)
LOG.info("Clearing traces of Playbook-VM for (openstack_id): {0}".format(k))
self.delete_keypair(key_name=self.redis.hget(k, "name").decode("utf-8"))
v.stop(k)
self.delete_server(openstack_id=k)
Expand Down Expand Up @@ -175,9 +173,7 @@ def __init__(self, config):
self.BIBIGRID_URL = self.BIBIGRID_URL.format(
host=self.BIBIGRID_HOST, port=self.BIBIGRID_PORT
)
LOG.info(
msg="Bibigrd url loaded: {0}".format(self.BIBIGRID_URL)
)
LOG.info(msg="Bibigrd url loaded: {0}".format(self.BIBIGRID_URL))
except Exception as e:
LOG.exception(e)
LOG.info("Bibigrid not loaded.")
Expand All @@ -188,9 +184,7 @@ def __init__(self, config):
self.RE_BACKEND_URL = cfg["forc"]["forc_url"]
self.FORC_API_KEY = os.environ["FORC_API_KEY"]
self.FORC_ALLOWED = cfg["forc"]["forc_allowed"]
LOG.info(
msg="Forc-Backend url loaded: {0}".format(self.RE_BACKEND_URL)
)
LOG.info(msg="Forc-Backend url loaded: {0}".format(self.RE_BACKEND_URL))
LOG.info(
"Client allows following research environments and respective versions: {0}".format(
self.FORC_ALLOWED
Expand Down Expand Up @@ -515,9 +509,7 @@ def get_server(self, openstack_id):
try:
server = self.conn.compute.get_server(openstack_id)
except Exception as e:
LOG.exception(
"No Server found {0} | Error {1}".format(openstack_id, e)
)
LOG.exception("No Server found {0} | Error {1}".format(openstack_id, e))
return VM(status="NOT FOUND")

serv = server.to_dict()
Expand Down Expand Up @@ -638,9 +630,7 @@ def get_network(self):
def create_mount_init_script(
self, volume_ids_path_new=None, volume_ids_path_attach=None
):
LOG.info(
"create init script for volume ids:{}".format(volume_ids_path_new)
)
LOG.info("create init script for volume ids:{}".format(volume_ids_path_new))
if not volume_ids_path_new and not volume_ids_path_attach:
return None

Expand Down Expand Up @@ -1122,9 +1112,7 @@ def create_and_deploy_playbook(
self, public_key, playbooks_information, openstack_id
):
global active_playbooks
LOG.info(
msg="Starting Playbook for (openstack_id): {0}".format(openstack_id)
)
LOG.info(msg="Starting Playbook for (openstack_id): {0}".format(openstack_id))
port = self.get_vm_ports(openstack_id=openstack_id)
key = self.redis.hget(openstack_id, "key").decode("utf-8")
playbook = Playbook(
Expand Down Expand Up @@ -1707,9 +1695,7 @@ def check_server_status(self, openstack_id):
server.status = self.BUILD
return server
except Exception as e:
LOG.exception(
"Check Status VM {0} error: {1}".format(openstack_id, e)
)
LOG.exception("Check Status VM {0} error: {1}".format(openstack_id, e))
return None

def openstack_server_to_thrift_server(self, server):
Expand All @@ -1725,9 +1711,7 @@ def openstack_server_to_thrift_server(self, server):
"size"
]
except Exception as e:
LOG.exception(
"Could not found volume {}: {}".format(volume_id, e)
)
LOG.exception("Could not found volume {}: {}".format(volume_id, e))

if server["OS-SRV-USG:launched_at"]:
dt = datetime.datetime.strptime(
Expand Down Expand Up @@ -1778,9 +1762,7 @@ def get_servers(self):
server_list.append(thrift_server)

except Exception as e:
LOG.exception(
"Could not transform to thrift_server: {}".format(e)
)
LOG.exception("Could not transform to thrift_server: {}".format(e))
LOG.info(
"Converted {} servers to thrift_server objects".format(len(server_list))
)
Expand Down Expand Up @@ -2023,9 +2005,7 @@ def create_snapshot(self, openstack_id, name, elixir_id, base_tags, description)
server=openstack_id, name=name
)
except ConflictException as e:
LOG.exception(
"Create snapshot {0} error: {1}".format(openstack_id, e)
)
LOG.exception("Create snapshot {0} error: {1}".format(openstack_id, e))

raise conflictException(Reason="409")
except Exception:
Expand Down Expand Up @@ -2195,15 +2175,11 @@ def delete_server(self, openstack_id):

return True
except ConflictException as e:
LOG.exception(
"Delete Server {0} error: {1}".format(openstack_id, e)
)
LOG.exception("Delete Server {0} error: {1}".format(openstack_id, e))

raise conflictException(Reason="409")
except Exception as e:
LOG.exception(
"Delete Server {0} error: {1}".format(openstack_id, e)
)
LOG.exception("Delete Server {0} error: {1}".format(openstack_id, e))
return False

def delete_volume_attachment(self, volume_id, server_id):
Expand Down Expand Up @@ -2352,9 +2328,7 @@ def resume_server(self, openstack_id):
else:
return False
except ConflictException as e:
LOG.exception(
"Resume Server {0} error: {1}".format(openstack_id, e)
)
LOG.exception("Resume Server {0} error: {1}".format(openstack_id, e))

raise conflictException(Reason="409")
except Exception as e:
Expand Down Expand Up @@ -2488,9 +2462,7 @@ def create_security_group(
security_group_id=new_security_group["id"],
)
if JUPYTERNOTEBOOK in resenv:
LOG.info(
"Add jupyternotebook rule to security group {}".format(name)
)
LOG.info("Add jupyternotebook rule to security group {}".format(name))

self.conn.network.create_security_group_rule(
direction="ingress",
Expand Down
6 changes: 2 additions & 4 deletions VirtualMachineService/ancon/Playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Playbook(object):
PLAYBOOK_FAILED = "PLAYBOOK_FAILED"

def __init__(
self, ip, port, playbooks_information, osi_private_key, public_key, pool
self, ip, port, playbooks_information, osi_private_key, public_key, pool
):
self.redis = redis.Redis(connection_pool=pool) # redis connection
self.yaml_exec = ruamel.yaml.YAML() # yaml writer/reader
Expand Down Expand Up @@ -240,9 +240,7 @@ def check_status(self, openstack_id):
)
)
elif done != 0:
LOG.info(
"Playbook for (openstack_id) {0} has failed.".format(openstack_id)
)
LOG.info("Playbook for (openstack_id) {0} has failed.".format(openstack_id))
self.redis.hset(openstack_id, "status", self.PLAYBOOK_FAILED)
self.returncode = self.process.returncode
self.process.wait()
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.bibigrid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
- portal

bibigrid:
image: bibiserv/bibigrid:bibigrid_rest_http_slurmfix
image: bibiserv/bibigrid:${BIBIGRID_TAG}

env_file:
- .env
Expand All @@ -49,6 +49,8 @@ services:
- OS_USER_DOMAIN_NAME
- OS_PROJECT_DOMAIN_ID
- OS_PROJECT_DOMAIN_NAME
- server.enableHttps=false
- server.enableHttp=true
expose:
- "8080"
networks:
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.dev.bibigrid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
- portal

bibigrid:
image: bibiserv/bibigrid:bibigrid_rest_http_slurmfix
image: bibiserv/bibigrid:${BIBIGRID_TAG}
environment:
- OS_AUTH_URL
- OS_PROJECT_ID
Expand All @@ -45,6 +45,8 @@ services:
- OS_USER_DOMAIN_NAME
- OS_PROJECT_DOMAIN_ID
- OS_PROJECT_DOMAIN_NAME
- server.enableHttps=false
- server.enableHttp=true

expose:
- "8080"
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
setuptools==49.2.1
setuptools==49.6.0
thrift >= 0.11.0,<0.20.0
python-keystoneclient
openstacksdk ==0.48.0
deprecated == 1.2.10
Click==7.1.2
flake8==3.8.3
ansible==2.9.11
ansible==2.9.12
ruamel.yaml<0.17.0
paramiko==2.7.1
pyvim==3.0.2
Expand Down

0 comments on commit ab17c36

Please sign in to comment.