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
1 change: 1 addition & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.01
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.10.2

ENV PYTHONUNBUFFERED 1

WORKDIR /adi

ADD requirements.txt /adi/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

# ① Install some dependencies
RUN apt-get update \
&& apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean


# Copy adi
ADD /adi /adi


VOLUME /usr/src
36 changes: 36 additions & 0 deletions Jenkinsfile_Devstart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pipeline {

environment {
DOCKERHUB_CREDENTIALS = credentials('avicoiot-dockerhub')
PRODUCT = 'ADI'
GIT_HOST = 'somewhere'
GIT_REPO = 'repo'
}
agent any

options {
buildDiscarder(logRotator(numToKeepStr: '3'))
}
stages {
stage('Build') {
steps {
sh 'docker build -t avicoiot/adi-alpine:latest .'
}
}
stage('Login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login --username $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Push') {
steps {
sh 'docker push avicoiot/adi-alpine:latest'
}
}
}
post {
always {
sh 'docker logout'
}
}
}
36 changes: 0 additions & 36 deletions Jenkinsfile_start

This file was deleted.

Empty file added RN.md
Empty file.
1 change: 1 addition & 0 deletions Untitled Diagram.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2023-01-24T15:43:02.102Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" version="20.8.10" etag="sVzuCxN98oUfDyyQU1v1" type="github"><diagram name="Page-1" id="odTgSxn9Hmhe4syxjLUJ">UzV2zq1wL0osyPDNT0nNUTV2VTV2LsrPL4GwciucU3NyVI0MMlNUjV1UjYwMgFjVyA2HrCFY1qAgsSg1rwSLBiADYTaQg2Y1AA==</diagram></mxfile>
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions app_config/db_config.py → adi/app_config/db_config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from app_config.settings import SingletonMeta
from adi.app_config.settings import SingletonMeta
from typing import Dict
from enum import Enum

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy_utils import database_exists, create_database
from sqlalchemy.sql import text


class DBType(str, Enum):
POSTGRES = "postgres"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from app_config.settings import SingletonMeta
from abc import ABC, abstractmethod
from typing import Dict
from enum import Enum
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions main.py → adi/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from app_config.settings import Settings
from app_config.db_config import DBContext
from app_config.task import Task
import os
from adi.app_config.settings import Settings
from adi.app_config.db_config import DBContext
from pathlib import Path
config_file = Path('app_config','config.yaml')
config_file = Path('app_config', 'config.yaml')

rules = 'application_conig.rules.'

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rabbitmq/celery_test/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from tasks import add
from proj.tasks import add
result = add.delay(4, 4)
result.get(propagate=False)
Binary file modified rabbitmq/celery_test/proj/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file modified rabbitmq/celery_test/proj/__pycache__/celery.cpython-310.pyc
Binary file not shown.
Binary file modified rabbitmq/celery_test/proj/__pycache__/tasks.cpython-310.pyc
Binary file not shown.
20 changes: 14 additions & 6 deletions rabbitmq/celery_test/proj/tasks.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from .celery import app
from time import sleep
from datetime import datetime
from decimal import Decimal,getcontext


@app.task
def add(x, y):

now = datetime.now()
current_time = now.strftime("%H:%M:%S")
print("AAAAAAA Current Time =", current_time)
print("I-->", x ,y )
# sleep(10)
# now = datetime.now()
# current_time = now.strftime("%H:%M:%S")
# print("Current Time =", current_time)
# print( x , "New -->" )
return x + y


Expand All @@ -23,9 +24,16 @@ def xsum(numbers):
return sum(numbers)


@app.task
def pi_calc():
sleep(1)
pi_val = 100
return pi_val


# adding watchdog - enable refersh with every change

#watchmedo auto-restart --directory=./proj --pattern=*.py --recursive -- celery -A proj worker --concurrency=1 --loglevel=INFO --pool=solo
#watchdog auto-restart --directory=./proj --pattern=*.py --recursive -- celery -A proj worker --concurrency=1 --loglevel=INFO --pool=solo

# execute regulary
#celery -A proj worker --pool=solo -l INFO
30 changes: 21 additions & 9 deletions rabbitmq/celery_test/test_celery_proj.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
from proj.tasks import add
from celery import group
from proj.tasks import add,pi_calc
from celery import group,signature
from time import sleep


def mylink(num):
return num+100




# res= pi_calc.delay()
# print(res.status)
# sleep(5)
# print(res.status,res.get())


# s1 = add.signature((2, 2), countdown=2)
# res = s1.delay()
#
# print(res.get())
# print(add(21,34))
#
for i in range(10):
print(add.apply_async((i, 2), queue='ZZ1Z'))

for i in range(5):
print(add.apply_async((i, -9)))

#
# g = group(add.s(i,2) for i in range(10))
# print(g(10).get())

# print(celery.chain(add.delay(1,3),
# mylink(2)).appl_async())

#
# g = group(add.s(i, i) for i in range(10))().get()
#
Expand Down
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
pip==22.3.1
setuptools==65.5.1
wheel==0.38.4
pip
setuptools
wheel
sqlalchemy
SQLAlchemy-Utils
numpy
pandas
python-decouple
pyyaml
psycopg2
psycopg2
celery