|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
import catboost
|
|
|
|
import catboost
|
|
|
|
import pandas as pd
|
|
|
|
import pandas as pd
|
|
|
|
import psycopg2
|
|
|
|
import psycopg2
|
|
|
|
@ -9,6 +11,7 @@ from sklearn import model_selection as ms
|
|
|
|
from sqlalchemy import text
|
|
|
|
from sqlalchemy import text
|
|
|
|
|
|
|
|
|
|
|
|
from postamates.settings import AGE_DAY_LIMIT
|
|
|
|
from postamates.settings import AGE_DAY_LIMIT
|
|
|
|
|
|
|
|
from postamates.settings import DB_URL
|
|
|
|
from service.models import PlacementPoint
|
|
|
|
from service.models import PlacementPoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -20,7 +23,7 @@ from service.models import PlacementPoint
|
|
|
|
@shared_task()
|
|
|
|
@shared_task()
|
|
|
|
def raschet():
|
|
|
|
def raschet():
|
|
|
|
conn = sqlalchemy.create_engine(
|
|
|
|
conn = sqlalchemy.create_engine(
|
|
|
|
'postgresql://sst_postamates_user:sst_postamates_pass@postnet-dev.selftech.ru:5487/sst_postamates_db',
|
|
|
|
DB_URL,
|
|
|
|
connect_args={'options': '-csearch_path=public'},
|
|
|
|
connect_args={'options': '-csearch_path=public'},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
query = text('select * from service_placementpoint')
|
|
|
|
query = text('select * from service_placementpoint')
|
|
|
|
@ -72,8 +75,10 @@ def raschet():
|
|
|
|
|
|
|
|
|
|
|
|
# Загрузка в базу обновленных значений
|
|
|
|
# Загрузка в базу обновленных значений
|
|
|
|
conn2 = psycopg2.connect(
|
|
|
|
conn2 = psycopg2.connect(
|
|
|
|
database='sst_postamates_db', user='sst_postamates_user', password='sst_postamates_pass',
|
|
|
|
database=os.getenv('POSTGRES_DB', 'postgres'), user=os.getenv('POSTGRES_USER', 'postgres'),
|
|
|
|
host='postnet-dev.selftech.ru', port='5487', options='-c search_path=public',
|
|
|
|
password=os.getenv('POSTGRES_PASSWORD', 'postgres'),
|
|
|
|
|
|
|
|
host=os.getenv('POSTGRES_HOST', 'postgres'), port=os.getenv('POSTGRES_PORT', 'postgres'),
|
|
|
|
|
|
|
|
options='-c search_path=public',
|
|
|
|
)
|
|
|
|
)
|
|
|
|
cursor = conn2.cursor()
|
|
|
|
cursor = conn2.cursor()
|
|
|
|
update_records1 = []
|
|
|
|
update_records1 = []
|
|
|
|
|