Ver Fonte

Update files for first release

oscarleiva há 7 anos atrás
pai
commit
db39a2629b

+ 81 - 2
.gitignore

@@ -1,25 +1,37 @@
+### Python ###
 # Byte-compiled / optimized / DLL files
 __pycache__/
 *.py[cod]
+*$py.class
 
 # C extensions
 *.so
 
 # Distribution / packaging
 .Python
-env/
 build/
 develop-eggs/
 dist/
+downloads/
 eggs/
+.eggs/
 lib/
 lib64/
 parts/
 sdist/
 var/
+wheels/
+share/python-wheels/
 *.egg-info/
 .installed.cfg
 *.egg
+MANIFEST
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
 
 # Installer logs
 pip-log.txt
@@ -28,10 +40,15 @@ pip-delete-this-directory.txt
 # Unit test / coverage reports
 htmlcov/
 .tox/
+.nox/
 .coverage
+.coverage.*
 .cache
 nosetests.xml
 coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
 
 # Translations
 *.mo
@@ -39,9 +56,71 @@ coverage.xml
 
 # Django stuff:
 *.log
+local_settings.py
+db.sqlite3
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
 
 # Sphinx documentation
 docs/_build/
 
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+### Python Patch ###
+.venv/
+
 # IPython notebook checkpoints
-.ipynb_checkpoints/
+.ipynb_checkpoints
+*/.ipynb_checkpoints/*
+
+
+*.swp

+ 39 - 0
etl/create_database_table.sql

@@ -0,0 +1,39 @@
+USE [DEV_MEIntegrado]
+GO
+
+SET ANSI_NULLS ON
+GO
+
+SET QUOTED_IDENTIFIER ON
+GO
+
+SET ANSI_PADDING ON
+GO
+
+CREATE TABLE [dbo].[PRONOSTICO_MEXICO_PML](
+	[FECHA_HORA] [datetime] NULL,
+	[PRECIO] [money] NULL,
+	[CREADO] [datetime] NOT NULL DEFAULT (getdate()),
+	[WHO_INAME_M] [varchar](20) NULL CONSTRAINT [CNST_PRONOSTICO_MEXICO_PML_AUDIT_NAME_I]  DEFAULT (suser_sname())
+) ON [PRIMARY]
+
+GO
+
+SET ANSI_PADDING OFF
+GO
+
+/******************************************
+
+CREACIÓN DE INDICE EN PRONOSTICO_MEXICO_PML
+
+*******************************************/
+USE [DEV_MEIntegrado]
+GO
+
+CREATE UNIQUE INDEX [INDX_PRONOSTICO_MEXICO_PML] ON [dbo].[PRONOSTICO_MEXICO_PML]
+(
+	[FECHA_HORA] ASC
+)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
+GO
+
+

+ 2 - 2
flask_api/app/server.py

@@ -31,7 +31,6 @@ def apicall():
 	Pandas dataframe (sent as a payload) from API Call
 	"""
 	prepro = PreProcessing()
-
 	
 	try:
 		data_json = request.data
@@ -48,6 +47,7 @@ def apicall():
 		forecast_datetime = data.index
 
 	except Exception as e:
+		
 		raise e
 	
 	rgs = 'lbrprice_model_svr.pkl'
@@ -99,4 +99,4 @@ def bad_request(error=None):
 	return resp
 
 if __name__ == '__main__':
-	app.run(host='0.0.0.0')
+	app.run(host='0.0.0.0')

+ 3 - 3
flask_api/docker-compose.yml

@@ -6,13 +6,13 @@ services:
     build:
       context: ./
     ports:
-      - "8001:8001"
-    command: gunicorn --log-level=info -w 2 -b :8001 server:app
+      - "8080:8080"
+    command: gunicorn --log-level=info -w 2 -b :8080 server:app
 
   nginx:
     restart: always
     build: ./nginx/
     ports:
-      - "80:80"
+      - "14080:80"
     links:
       - web

+ 1 - 1
flask_api/nginx/sites-enabled/app

@@ -5,7 +5,7 @@ server {
     charset utf-8;
 
     location / {
-        proxy_pass http://web:8001;
+        proxy_pass http://web:8080;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;