-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lei Wang <jiede.wl@alibaba-inc.com>
- Loading branch information
1 parent
bfbe1ad
commit c874ce1
Showing
104 changed files
with
16,246 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# ref: https://docs.travis-ci.com/user/languages/python | ||
language: python | ||
python: | ||
- "3.2" | ||
- "3.3" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
# command to install dependencies | ||
install: "pip install -r requirements.txt" | ||
# command to run tests | ||
script: nosetests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM python:3-alpine | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
COPY requirements.txt /usr/src/app/ | ||
|
||
RUN pip3 install --no-cache-dir -r requirements.txt | ||
|
||
COPY . /usr/src/app | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["python3"] | ||
|
||
CMD ["-m", "flex.server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# OpenAPI generated server | ||
|
||
## Overview | ||
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the | ||
[OpenAPI-Spec](https://openapis.org) from a remote server, you can easily generate a server stub. This | ||
is an example of building a OpenAPI-enabled Flask server. | ||
|
||
This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask. | ||
|
||
## Requirements | ||
Python 3.5.2+ | ||
|
||
## Usage | ||
To run the server, please execute the following from the root directory: | ||
|
||
``` | ||
pip3 install -r requirements.txt | ||
python3 -m flex.server | ||
``` | ||
|
||
and open your browser to here: | ||
|
||
``` | ||
http://localhost:8080/ui/ | ||
``` | ||
|
||
Your OpenAPI definition lives here: | ||
|
||
``` | ||
http://localhost:8080/openapi.json | ||
``` | ||
|
||
To launch the integration tests, use tox: | ||
``` | ||
sudo pip install tox | ||
tox | ||
``` | ||
|
||
## Running with Docker | ||
|
||
To run the server on a Docker container, please execute the following from the root directory: | ||
|
||
```bash | ||
# building the image | ||
docker build -t flex.server . | ||
|
||
# starting up a container | ||
docker run -p 8080:8080 flex.server | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import connexion | ||
|
||
from flex.server import encoder | ||
|
||
|
||
def main(): | ||
app = connexion.App(__name__, specification_dir='./openapi/') | ||
app.app.json_encoder = encoder.JSONEncoder | ||
app.add_api('openapi.yaml', | ||
arguments={'title': 'GraphScope FLEX HTTP SERVICE API'}, | ||
pythonic_params=True) | ||
|
||
app.run(port=18080) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
161 changes: 161 additions & 0 deletions
161
coordinator/flex/server/controllers/alert_controller.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
import connexion | ||
from typing import Dict | ||
from typing import Tuple | ||
from typing import Union | ||
|
||
from flex.server.models.create_alert_receiver_request import CreateAlertReceiverRequest # noqa: E501 | ||
from flex.server.models.create_alert_rule_request import CreateAlertRuleRequest # noqa: E501 | ||
from flex.server.models.error import Error # noqa: E501 | ||
from flex.server.models.get_alert_message_response import GetAlertMessageResponse # noqa: E501 | ||
from flex.server.models.get_alert_receiver_response import GetAlertReceiverResponse # noqa: E501 | ||
from flex.server.models.get_alert_rule_response import GetAlertRuleResponse # noqa: E501 | ||
from flex.server.models.update_alert_message_status_request import UpdateAlertMessageStatusRequest # noqa: E501 | ||
from flex.server import util | ||
|
||
|
||
def create_alert_receiver(create_alert_receiver_request): # noqa: E501 | ||
"""create_alert_receiver | ||
Create a new alert receiver # noqa: E501 | ||
:param create_alert_receiver_request: | ||
:type create_alert_receiver_request: dict | bytes | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
if connexion.request.is_json: | ||
create_alert_receiver_request = CreateAlertReceiverRequest.from_dict(connexion.request.get_json()) # noqa: E501 | ||
return 'do some magic!' | ||
|
||
|
||
def delete_alert_message_in_batch(message_ids): # noqa: E501 | ||
"""delete_alert_message_in_batch | ||
Delete alert message in batch # noqa: E501 | ||
:param message_ids: A list of message id separated by comma, e.g. id1,id2,id3 | ||
:type message_ids: str | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def delete_alert_receiver_by_id(receiver_id): # noqa: E501 | ||
"""delete_alert_receiver_by_id | ||
Delete the alert receiver by ID # noqa: E501 | ||
:param receiver_id: | ||
:type receiver_id: str | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def delete_alert_rule_by_id(rule_id): # noqa: E501 | ||
"""delete_alert_rule_by_id | ||
# noqa: E501 | ||
:param rule_id: | ||
:type rule_id: str | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def list_alert_messages(alert_type=None, status=None, severity=None, start_time=None, end_time=None, limit=None): # noqa: E501 | ||
"""list_alert_messages | ||
List all alert messages # noqa: E501 | ||
:param alert_type: | ||
:type alert_type: str | ||
:param status: | ||
:type status: str | ||
:param severity: | ||
:type severity: str | ||
:param start_time: format with \"2023-02-21-11-56-30\" | ||
:type start_time: str | ||
:param end_time: format with \"2023-02-21-11-56-30\" | ||
:type end_time: str | ||
:param limit: | ||
:type limit: int | ||
:rtype: Union[List[GetAlertMessageResponse], Tuple[List[GetAlertMessageResponse], int], Tuple[List[GetAlertMessageResponse], int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def list_alert_receivers(): # noqa: E501 | ||
"""list_alert_receivers | ||
List all alert receivers # noqa: E501 | ||
:rtype: Union[List[GetAlertReceiverResponse], Tuple[List[GetAlertReceiverResponse], int], Tuple[List[GetAlertReceiverResponse], int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def list_alert_rules(): # noqa: E501 | ||
"""list_alert_rules | ||
List all alert rules # noqa: E501 | ||
:rtype: Union[List[GetAlertRuleResponse], Tuple[List[GetAlertRuleResponse], int], Tuple[List[GetAlertRuleResponse], int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def update_alert_message_in_batch(update_alert_message_status_request=None): # noqa: E501 | ||
"""update_alert_message_in_batch | ||
Update the message status in batch # noqa: E501 | ||
:param update_alert_message_status_request: | ||
:type update_alert_message_status_request: dict | bytes | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
if connexion.request.is_json: | ||
update_alert_message_status_request = UpdateAlertMessageStatusRequest.from_dict(connexion.request.get_json()) # noqa: E501 | ||
return 'do some magic!' | ||
|
||
|
||
def update_alert_receiver_by_id(receiver_id, create_alert_receiver_request=None): # noqa: E501 | ||
"""update_alert_receiver_by_id | ||
Update alert receiver by ID # noqa: E501 | ||
:param receiver_id: | ||
:type receiver_id: str | ||
:param create_alert_receiver_request: | ||
:type create_alert_receiver_request: dict | bytes | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
if connexion.request.is_json: | ||
create_alert_receiver_request = CreateAlertReceiverRequest.from_dict(connexion.request.get_json()) # noqa: E501 | ||
return 'do some magic!' | ||
|
||
|
||
def update_alert_rule_by_id(rule_id, create_alert_rule_request=None): # noqa: E501 | ||
"""update_alert_rule_by_id | ||
# noqa: E501 | ||
:param rule_id: | ||
:type rule_id: str | ||
:param create_alert_rule_request: | ||
:type create_alert_rule_request: dict | bytes | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
if connexion.request.is_json: | ||
create_alert_rule_request = CreateAlertRuleRequest.from_dict(connexion.request.get_json()) # noqa: E501 | ||
return 'do some magic!' |
72 changes: 72 additions & 0 deletions
72
coordinator/flex/server/controllers/data_source_controller.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import connexion | ||
from typing import Dict | ||
from typing import Tuple | ||
from typing import Union | ||
|
||
from flex.server.models.error import Error # noqa: E501 | ||
from flex.server.models.schema_mapping import SchemaMapping # noqa: E501 | ||
from flex.server import util | ||
|
||
|
||
def bind_datasource_in_batch(graph_id, schema_mapping): # noqa: E501 | ||
"""bind_datasource_in_batch | ||
Bind data sources in batches # noqa: E501 | ||
:param graph_id: | ||
:type graph_id: str | ||
:param schema_mapping: | ||
:type schema_mapping: dict | bytes | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
if connexion.request.is_json: | ||
schema_mapping = SchemaMapping.from_dict(connexion.request.get_json()) # noqa: E501 | ||
return 'do some magic!' | ||
|
||
|
||
def get_datasource_by_id(graph_id): # noqa: E501 | ||
"""get_datasource_by_id | ||
Get data source by ID # noqa: E501 | ||
:param graph_id: | ||
:type graph_id: str | ||
:rtype: Union[SchemaMapping, Tuple[SchemaMapping, int], Tuple[SchemaMapping, int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def unbind_edge_datasource(graph_id, type_name, source_vertex_type, destination_vertex_type): # noqa: E501 | ||
"""unbind_edge_datasource | ||
Unbind datas ource on an edge type # noqa: E501 | ||
:param graph_id: | ||
:type graph_id: str | ||
:param type_name: | ||
:type type_name: str | ||
:param source_vertex_type: | ||
:type source_vertex_type: str | ||
:param destination_vertex_type: | ||
:type destination_vertex_type: str | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' | ||
|
||
|
||
def unbind_vertex_datasource(graph_id, type_name): # noqa: E501 | ||
"""unbind_vertex_datasource | ||
Unbind data source on a vertex type # noqa: E501 | ||
:param graph_id: | ||
:type graph_id: str | ||
:param type_name: | ||
:type type_name: str | ||
:rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] | ||
""" | ||
return 'do some magic!' |
Oops, something went wrong.