Skip to content

Commit

Permalink
updated imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Dec 20, 2023
1 parent 217a54a commit 5c8e892
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 43 deletions.
45 changes: 28 additions & 17 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
name: 'coverage'
# This workflow will install dependencies, create coverage tests and run Pytest Coverage Comment
# For more information see: https://github.com/MishaKav/pytest-coverage-comment/
name: pytest-coverage-comment
on:
pull_request:
workflow_dispatch:
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install coverage
run: pip install coverage
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run Coverage
run: cd simple_vm_client && coverage xml coverage.xml
- name: Build coverage file
run: |
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=simple_vm_client | tee pytest-coverage.txt
- name: Get Cover
uses: orgoro/coverage@v3.1
with:
coverageFile: simple_vm_client/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
13 changes: 7 additions & 6 deletions simple_vm_client/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

from typing import TYPE_CHECKING

from bibigrid_connector.bibigrid_connector import BibigridConnector
from forc_connector.forc_connector import ForcConnector
from openstack_connector.openstack_connector import OpenStackConnector
from util import thrift_converter
from util.logger import setup_custom_logger
from VirtualMachineService import Iface
from simple_vm_client.bibigrid_connector.bibigrid_connector import BibigridConnector
from simple_vm_client.forc_connector.forc_connector import ForcConnector
from simple_vm_client.openstack_connector.openstack_connector import OpenStackConnector
from simple_vm_client.util import thrift_converter
from simple_vm_client.util.logger import setup_custom_logger

from .VirtualMachineService import Iface

if TYPE_CHECKING:
from ttypes import (
Expand Down
5 changes: 3 additions & 2 deletions simple_vm_client/VirtualMachineServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
from thrift.transport import TSocket, TSSLSocket, TTransport
from VirtualMachineHandler import VirtualMachineHandler
from VirtualMachineService import Processor

from simple_vm_client.VirtualMachineHandler import VirtualMachineHandler
from simple_vm_client.VirtualMachineService import Processor

USERNAME = "OS_USERNAME"
PASSWORD = "OS_PASSWORD"
Expand Down
3 changes: 2 additions & 1 deletion simple_vm_client/VirtualMachineService.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions simple_vm_client/bibigrid_connector/bibigrid_connector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import requests
import yaml
from ttypes import ClusterInfo, ClusterInstance
from util.logger import setup_custom_logger

from simple_vm_client.ttypes import ClusterInfo, ClusterInstance
from simple_vm_client.util.logger import setup_custom_logger

logger = setup_custom_logger(__name__)

Expand Down
5 changes: 0 additions & 5 deletions simple_vm_client/constants.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions simple_vm_client/forc_connector/forc_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import requests
import yaml
from openstack.compute.v2.server import Server
from ttypes import (

from simple_vm_client.ttypes import (
Backend,
BackendNotFoundException,
CondaPackage,
Expand All @@ -16,8 +17,8 @@
PlaybookResult,
TemplateNotFoundException,
)
from util.logger import setup_custom_logger
from util.state_enums import VmTaskStates
from simple_vm_client.util.logger import setup_custom_logger
from simple_vm_client.util.state_enums import VmTaskStates

from .playbook.playbook import Playbook
from .template.template import ResearchEnvironmentMetadata, Template
Expand Down
7 changes: 4 additions & 3 deletions simple_vm_client/forc_connector/playbook/playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import redis
import ruamel.yaml
from ttypes import CondaPackage
from util.logger import setup_custom_logger
from util.state_enums import VmTaskStates

from simple_vm_client.ttypes import CondaPackage
from simple_vm_client.util.logger import setup_custom_logger
from simple_vm_client.util.state_enums import VmTaskStates

CONDA = "conda"
MOSH = "mosh"
Expand Down
8 changes: 4 additions & 4 deletions simple_vm_client/util/thrift_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from openstack.compute.v2.flavor import Flavor as OpenStack_Flavor
from openstack.compute.v2.image import Image as OpenStack_Image
from openstack.compute.v2.server import Server as OpenStack_Server
from ttypes import VM, Flavor, Image, Snapshot, Volume
from util.logger import setup_custom_logger
from util.state_enums import VmStates

from simple_vm_client.ttypes import VM, Flavor, Image, Snapshot, Volume
from simple_vm_client.util.logger import setup_custom_logger
from simple_vm_client.util.state_enums import VmStates

logger = setup_custom_logger(__name__)

Expand Down Expand Up @@ -110,7 +111,6 @@ def os_to_thrift_server(openstack_server: OpenStack_Server) -> VM:
image = None
for values in openstack_server.addresses.values():
for address in values:

if address["OS-EXT-IPS:type"] == "floating":
floating_ip = address["addr"]
elif address["OS-EXT-IPS:type"] == "fixed":
Expand Down

0 comments on commit 5c8e892

Please sign in to comment.