Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions api/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@

from flask import Flask, g
import logging.config
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
import pika
import sys
import uuid
from celery import Celery

import pika
from app.decorators.restplus import api as api_rest_plus
from celery import Celery
from flask import Flask, g
from flask_cors import CORS
from flask_login import LoginManager
from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy

from . import constants

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

"""__________________________________producer for COMPUTE_______________________________________________________"""

Expand Down Expand Up @@ -67,7 +71,6 @@ def is_calculation_module_alive(self,cm_id):



from . import constants


dbGIS = SQLAlchemy()
Expand Down
14 changes: 8 additions & 6 deletions api/app/api_v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from flask import Blueprint
api = Blueprint('api', __name__, url_prefix='/api')
from .stats import nsStats
from .heat_load_profile import load_profile_namespace

from ..decorators import etag
from . import computation_module
from .computation_module import nsCM
from .users import nsUsers
from .upload import nsUpload
from .heat_load_profile import load_profile_namespace
from .snapshot import nsSnapshot
from .stats import nsStats
from .upload import nsUpload
from .users import nsUsers

api = Blueprint('api', __name__, url_prefix='/api')

@api.before_request
def before_request():
Expand All @@ -21,5 +24,4 @@ def after_request(rv):

return rv

from . import computation_module
# from . import computation, errors
40 changes: 18 additions & 22 deletions api/app/api_v1/computation_module.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
from celery.task.control import revoke

import json
import os
import signal
from flask import request, current_app,jsonify,redirect, \
url_for,Response

import requests
from app import CalculationModuleRpcClient, celery, helper, model
from app.constants import DATASET_DIRECTORY, UPLOAD_DIRECTORY
from app.decorators.exceptions import ComputationalModuleError, ValidationError
from app.decorators.restplus import api
from app.decorators.serializers import compution_module_class, \
input_computation_module, test_communication_cm, \
compution_module_list, uploadfile, cm_id_input
from app.decorators.serializers import (cm_id_input, compution_module_class,
compution_module_list,
input_computation_module,
test_communication_cm, uploadfile)
from app.model import getCMList, getUI, register_calulation_module
from celery.task.control import revoke
from flask import (Response, current_app, jsonify, redirect, request,
send_file, send_from_directory, url_for)
from flask_restplus import Resource

from app.model import register_calulation_module,getUI,getCMList
from ..constants import DEFAULT_TIMEOUT
from ..decorators.timeout import timeout_signal_handler
from ..helper import commands_in_array, run_command

from ..models.user import User
from app import model

from app import helper
nsCM = api.namespace('cm', description='Operations related to statistisdscs')

ns = nsCM
from flask_restplus import Resource
from app import celery
import requests

from app.decorators.exceptions import ValidationError, ComputationalModuleError

import os
import json
from flask import send_from_directory, send_file
from app.constants import UPLOAD_DIRECTORY, DATASET_DIRECTORY

from app import CalculationModuleRpcClient
from ..decorators.timeout import timeout_signal_handler
from ..constants import DEFAULT_TIMEOUT


#TODO Add url to find right computation module
Expand Down
3 changes: 2 additions & 1 deletion api/app/api_v1/errors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from app.decorators.exceptions import ComputationalModuleError, ValidationError
from flask import jsonify
from app.decorators.exceptions import ValidationError, ComputationalModuleError

from . import api


Expand Down
26 changes: 13 additions & 13 deletions api/app/api_v1/heat_load_profile.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
from app import celery
import logging
from flask_restplus import Resource
from app.decorators.serializers import load_profile_aggregation_day_input, \
load_profile_aggregation_curve_output, load_profile_aggregation_curve, load_profile_aggregation_hectares, \
load_profile_aggregation_curve_hectares
from app.decorators.restplus import api
from app.decorators.exceptions import IntersectionException, HugeRequestException, ParameterException, RequestException
from app.models.heatloadQueries import HeatLoadProfile
from .. import helper
from ..decorators.timeout import return_on_timeout_endpoint



import shapely.geometry as shapely_geom

from app import celery
from app.decorators.exceptions import (HugeRequestException,
IntersectionException,
ParameterException, RequestException)
from app.decorators.restplus import api
from app.decorators.serializers import (
load_profile_aggregation_curve, load_profile_aggregation_curve_hectares,
load_profile_aggregation_curve_output, load_profile_aggregation_day_input,
load_profile_aggregation_hectares)
from app.models import generalData
from app.models.heatloadQueries import HeatLoadProfile
from flask_restplus import Resource

from .. import helper
from ..decorators.timeout import return_on_timeout_endpoint

log = logging.getLogger(__name__)

Expand Down
26 changes: 17 additions & 9 deletions api/app/api_v1/snapshot.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
from .. import dbGIS as db
from ..decorators.restplus import api
from ..decorators.exceptions import RequestException, ParameterException, UserUnidentifiedException, \
SnapshotNotExistingException
from ..models.user import User
from ..models.snapshots import Snapshots
from ..decorators.serializers import snapshot_load_input, snapshot_load_output, snapshot_add_input, \
snapshot_add_output, snapshot_delete_input, snapshot_delete_output, snapshot_list_input, snapshot_list_output, \
snapshot_update_input, snapshot_update_output
from app import celery
from flask_restplus import Resource

from .. import dbGIS as db
from ..decorators.exceptions import (ParameterException, RequestException,
SnapshotNotExistingException,
UserUnidentifiedException)
from ..decorators.restplus import api
from ..decorators.serializers import (snapshot_add_input, snapshot_add_output,
snapshot_delete_input,
snapshot_delete_output,
snapshot_list_input,
snapshot_list_output,
snapshot_load_input,
snapshot_load_output,
snapshot_update_input,
snapshot_update_output)
from ..decorators.timeout import return_on_timeout_endpoint
from ..models.snapshots import Snapshots
from ..models.user import User

nsSnapshot = api.namespace('snapshot', description='Operations related to snapshots')
ns = nsSnapshot
Expand Down
Loading