Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e63c7de
CORS enabled
Rahuljagwani Feb 19, 2023
9b46d89
Merge branch 'ControlCore-Project:main' into main
Rahuljagwani Feb 19, 2023
8883667
Remove checkout dev comment from FRI readme
pradeeban Feb 19, 2023
6724a82
Merge pull request #47 from ControlCore-Project/dev
pradeeban Feb 19, 2023
8b12c99
Update DOCKER-README.md
parteekcoder Feb 20, 2023
43f44a3
Merge branch 'ControlCore-Project:main' into main
Rahuljagwani Feb 20, 2023
9ccfba1
Merge pull request #48 from parteekcoder/main
pradeeban Feb 20, 2023
c39f076
Merge branch 'ControlCore-Project:main' into main
Rahuljagwani Feb 20, 2023
8fa6bb3
Windows for concore configured
Rahuljagwani Feb 21, 2023
74f9640
unnecessary files removed
Rahuljagwani Feb 21, 2023
3fa617c
Merge pull request #51 from Rahuljagwani/concoreForWindows
pradeeban Feb 22, 2023
4132048
output directory argument mentioned
Rahuljagwani Feb 23, 2023
5368ba2
destroy was giving error
Rahuljagwani Feb 23, 2023
b7403da
if else check for outdir
Rahuljagwani Feb 23, 2023
219bd14
Merge pull request #54 from Rahuljagwani/main
pradeeban Feb 23, 2023
b64ad13
directory name added in destroy api call in main.py
Rahuljagwani Feb 27, 2023
e341d4b
Merge branch 'ControlCore-Project:main' into main
Rahuljagwani Feb 27, 2023
889d68d
Merge pull request #55 from Rahuljagwani/main
pradeeban Feb 27, 2023
be7aaff
Merge pull request #1 from ControlCore-Project/main
shivangvijay Mar 11, 2023
a582535
With one step all the dependencies installed and updating README.md
shivangvijay Mar 11, 2023
2745233
Resolve issue #63
shivangvijay Mar 12, 2023
c975038
Merge pull request #61 from shivangvijay/main
pradeeban Mar 15, 2023
4cfcf40
Update funcall2.py
markgarnold Mar 24, 2023
9631b01
created nintab
markgarnold Mar 24, 2023
b1ad31b
Update with nidaqmx
pradeeban Mar 24, 2023
393d7d5
sec count+- and lights
markgarnold Mar 27, 2023
7e39c50
Close the file due to the warnings during interaction with nidaqmx
pradeeban Mar 27, 2023
67ba100
Added docker-compose.yml
shivangvijay Mar 29, 2023
823ba8a
Merge pull request #68 from shivangvijay/main
pradeeban Mar 29, 2023
d6fd1ea
Updated Docker Readme.md, Installation of Docker
shivangvijay Mar 29, 2023
4fa615f
Update DOCKER-README.md
shivangvijay Mar 29, 2023
1eeefcd
pacq reads and writes ym
markgarnold Mar 29, 2023
c28ae07
Merge branch 'main' of https://github.com/ControlCore-Project/concore…
markgarnold Mar 29, 2023
650bb54
paqc0 start,join
markgarnold Apr 2, 2023
88f0f5c
pacq overlap extract
markgarnold Apr 2, 2023
3f5e1d9
pacq has RHX code
markgarnold Apr 3, 2023
edaf0de
Merge pull request #69 from shivangvijay/main
pradeeban Apr 4, 2023
4fb3bfc
Update pacq.py
markgarnold Apr 5, 2023
444aaed
Merge branch 'main' of https://github.com/ControlCore-Project/concore
markgarnold Apr 5, 2023
39619cd
README to start nintan - a draft version
pradeeban Apr 5, 2023
5cdf26b
Fix indendation in pacq.py
pradeeban Apr 5, 2023
b152bae
params pw,showPlot,tsamp
markgarnold Apr 9, 2023
68cdba1
validseq,plot=3,bangbang=True,clearall
markgarnold Apr 12, 2023
1670068
Update pacq.py
pradeeban Apr 12, 2023
550bfb8
Update pacq.py
pradeeban Apr 12, 2023
3edb9ca
Update pacq.py
pradeeban Apr 14, 2023
d4d13e0
Update pacq.py
pradeeban Apr 14, 2023
d623c4c
validseq return index; check valid t=0; oldAmpD[validindex:]
markgarnold Apr 19, 2023
9d8d9a2
Update pacq.py
pradeeban Apr 19, 2023
ef12aa9
Adrian's poll runmode
markgarnold Apr 21, 2023
3694ea3
Update pacq.py
pradeeban Apr 21, 2023
57153af
Update pacq.py
pradeeban Apr 24, 2023
55f080d
bruteforce
markgarnold Apr 28, 2023
36493c0
dom_freq in pacq
markgarnold Apr 28, 2023
9319efc
Update pacq.py
pradeeban Apr 28, 2023
26667dc
Update pacq.py
pradeeban Apr 28, 2023
75b9ab7
Update cstim.py
pradeeban Apr 28, 2023
28afb1b
Update cstim.py
pradeeban May 1, 2023
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 0mq/funcall2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# ym = concore2.read(concore.iport['Y1'],"ym",init_simtime_ym)
paired_transmitter = PairedTransmitter(
remote_host="localhost", exposed_commands=[],
#remote_host="193.136.132.10", exposed_commands=[],
remote_port=2345, listen_port=2346,)
paired_transmitter.start_background_sync()
ym = paired_transmitter.request_with_immediate_reply(
Expand Down
4 changes: 3 additions & 1 deletion concore.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ def read(port, name, initstr):
try:
infile = open(inpath+str(port)+"/"+name);
ins = infile.read()
infile.close()
except:
ins = initstr
while len(ins)==0:
time.sleep(delay)
infile = open(inpath+str(port)+"/"+name);
ins = infile.read()
infile.close()
retrycount += 1
s += ins
inval = literal_eval(ins)
Expand Down Expand Up @@ -110,4 +113,3 @@ def initval(simtime_val):
val = literal_eval(simtime_val)
simtime = val[0]
return val[1:]

31 changes: 26 additions & 5 deletions fri/DOCKER-README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# Install Docker:-

Open Terminal and run the following commands:-

````
$ sudo apt-get update
$ sudo apt-get install curl
$ curl -fsSL https://get.docker.com/ | sh
````
Optional command:- To run docker commands without sudo
````
$ sudo usermod -aG docker <system_username>
````
The above command add the system username in the docker group, Restart the system to complete the process.

After restart run

````
$ sudo service docker start
````

# Building FRI Container

Now, we elaborate on building FRI as a container, together with the Kong API Gateway.
Expand All @@ -15,7 +36,7 @@ First build the Docker Container of the FRI.
````
$ git pull

$ sudo docker build -t fri .
$ docker build -t fri .
````

# Running Control-Core FRI with Kong as containers
Expand Down Expand Up @@ -67,7 +88,7 @@ $ docker run -d --name kong \

Start FRI container
````
$ nohup sudo docker run --name fri -p 8090:8081 fri > controlcore.out &
$ nohup sudo docker run --name fri -p 8090:8080 fri > controlcore.out &
````

Delete if there is a previously configured Kong service. If not, skip this step. First you need to find the ID-VALUE for the route with a GET command before deleting the route and service.
Expand Down Expand Up @@ -107,17 +128,17 @@ $ tail -f controlcore.out
````
or
````
$ sudo docker logs fri -f
$ docker logs fri -f
````
Find the FRI docker container
````
$ sudo docker ps
$ docker ps
````
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dfdd3b3d3308 fri "python main.py" 38 minutes ago Up 38 minutes 0.0.0.0:80->80/tcp fri

Access the container
````
$ sudo docker exec -it dfdd /bin/bash
$ docker exec -it dfdd /bin/bash
````

7 changes: 3 additions & 4 deletions fri/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ The Control-Core File Receiving Interface (FRI) is built with is Python-3.10. It

# Install Dependencies

Install Jupyter lab
````
$ pip install jupyterlab
$ cd conore/fri

$ pip3 install -r requirements.txt
````

# Running the FRI and a quick test.
Expand All @@ -15,8 +16,6 @@ To run the FRI as a server:
````
$ cd conore/fri

$ git checkout dev

$ cd server

$ python3 main.py
Expand Down
37 changes: 37 additions & 0 deletions fri/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '3'

services:
fri:
build:
context: .
image: fri
ports:
- 8090:8080
command: tail -f /dev/null

kong-database:
image: cassandra:3
ports:
- 9042:9042

kong:
image: kong
depends_on:
- kong-database
environment:
KONG_DATABASE: cassandra
KONG_PG_HOST: kong-database
KONG_PG_PASSWORD: kong
KONG_CASSANDRA_CONTACT_POINTS: kong-database
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_ADMIN_LISTEN: 0.0.0.0:8001, 0.0.0.0:8444 ssl
ports:
- 80:8000
- 8443:8443
- 8001:8001
- 8444:8444


1 change: 1 addition & 0 deletions fri/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Flask
gunicorn==20.1.0
FLASK_CORS
jupyterlab
86 changes: 58 additions & 28 deletions fri/server/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from flask import Flask, request, jsonify, send_file, send_from_directory
from werkzeug.utils import secure_filename
import os
import subprocess
from subprocess import call
from pathlib import Path
import json
import subprocess
import platform
from flask_cors import CORS, cross_origin

cur_path = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -21,8 +22,10 @@
@app.route('/upload/<dir>', methods=['POST'])
def upload(dir):
apikey = request.args.get('apikey')
dirname = secure_filename(dir) + "_" + apikey

if(apikey == None):
dirname = secure_filename(dir)
else:
dirname = secure_filename(dir) + "_" + apikey
if 'files[]' not in request.files:
resp = jsonify({'message': 'No file in the request'})
resp.status_code = 400
Expand All @@ -38,7 +41,6 @@ def upload(dir):
if not os.path.isdir(directory_name):
os.mkdir(directory_name)


for file in files:
if file:
filename = secure_filename(file.filename)
Expand All @@ -60,32 +62,52 @@ def upload(dir):
return resp



# to download /build/<dir>?fetch=<graphml>. For example, /build/test?fetch=sample1&apikey=xyz
@app.route('/build/<dir>', methods=['POST'])
def build(dir):
graphml_file = request.args.get('fetch')
apikey = request.args.get('apikey')
dirname = secure_filename(dir) + "_" + apikey
out_dir = request.args.get('outdir')
if(apikey == None):
dirname = secure_filename(dir)
else:
dirname = secure_filename(dir) + "_" + apikey
makestudy_dir = dirname + "/" + graphml_file #for makestudy
dir_path = os.path.abspath(os.path.join(concore_path, graphml_file)) #path for ./build
if(out_dir == None or out_dir == ""):
dir_path = os.path.abspath(os.path.join(concore_path, graphml_file)) #path for ./build
else:
dir_path = os.path.abspath(os.path.join(concore_path, out_dir)) #path for ./build
if not os.path.exists(dir_path):
proc = call(["./makestudy", makestudy_dir], cwd=concore_path)
if(platform.uname()[0]=='Windows'):
if(out_dir == None or out_dir == ""):
proc= call(["makestudy", makestudy_dir], shell=True, cwd=concore_path)
else:
proc= call(["makestudy", makestudy_dir, out_dir], shell=True, cwd=concore_path)
else:
if(out_dir == None or out_dir == ""):
proc= call(["./makestudy", makestudy_dir], cwd=concore_path)
else:
proc= call(["./makestudy", makestudy_dir, out_dir], cwd=concore_path)
if(proc == 0):
resp = jsonify({'message': 'Directory successfully created'})
resp.status_code = 201
else:
resp = jsonify({'message': 'There is an Error'})
resp.status_code = 500
call(["./build"], cwd=dir_path)
resp.status_code = 500
if(platform.uname()[0]=='Windows'):
call(["build"], cwd=dir_path, shell=True)
else:
call(["./build"], cwd=dir_path)
return resp


@app.route('/debug/<dir>', methods=['POST'])
def debug(dir):
dir = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir))
proc = call(["./debug"], cwd=dir_path)
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["debug"],shell=True, cwd=dir_path)
else:
proc = call(["./debug"], cwd=dir_path)
if(proc == 0):
resp = jsonify({'message': 'Close the pop window after obtaining result'})
resp.status_code = 201
Expand All @@ -95,12 +117,14 @@ def debug(dir):
resp.status_code = 500
return resp


@app.route('/run/<dir>', methods=['POST'])
def run(dir):
dir = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir))
proc = call(["./run"], cwd=dir_path)
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["run"],shell=True, cwd=dir_path)
else:
proc = call(["./run"], cwd=dir_path)
if(proc == 0):
resp = jsonify({'message': 'result prepared'})
resp.status_code = 201
Expand All @@ -112,9 +136,12 @@ def run(dir):

@app.route('/stop/<dir>', methods=['POST'])
def stop(dir):
dir = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir))
proc = call(["./stop"], cwd=dir_path)
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["stop"],shell=True, cwd=dir_path)
else:
proc = call(["./stop"], cwd=dir_path)
if(proc == 0):
resp = jsonify({'message': 'resources cleaned'})
resp.status_code = 201
Expand All @@ -127,9 +154,12 @@ def stop(dir):

@app.route('/clear/<dir>', methods=['POST'])
def clear(dir):
dir = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir))
proc = call(["./clear"], cwd=dir_path)
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["clear"],shell=True, cwd=dir_path)
else:
proc = call(["./clear"], cwd=dir_path)
if(proc == 0):
resp = jsonify({'message': 'result deleted'})
resp.status_code = 201
Expand Down Expand Up @@ -157,11 +187,13 @@ def download(dir):
resp.status_code = 400
return resp


@app.route('/destroy/<dir>', methods=['DELETE'])
def destroy(dir):
dir = secure_filename(dir)
proc = call(["./destroy", dir], cwd=concore_path)
if(platform.uname()[0]=='Windows'):
proc=call(["destroy", dir],shell=True, cwd=concore_path)
else:
proc = call(["./destroy", dir], cwd=concore_path)
if(proc == 0):
resp = jsonify({'message': 'Successfuly deleted Dirctory'})
resp.status_code = 201
Expand All @@ -181,7 +213,6 @@ def getFilesList(dir):
res = json.dumps(res)
return res


@app.route('/openJupyter/', methods=['POST'])
def openJupyter():
proc = subprocess.Popen(['jupyter', 'lab'], shell=False, stdout=subprocess.PIPE, cwd=concore_path)
Expand All @@ -195,6 +226,5 @@ def openJupyter():
return resp



if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
Loading