From 41320483a4a78e79e796217ae99e3941a303b721 Mon Sep 17 00:00:00 2001 From: Rahul Date: Thu, 23 Feb 2023 14:34:54 +0530 Subject: [PATCH 1/3] output directory argument mentioned --- fri/server/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fri/server/main.py b/fri/server/main.py index a548d34..48e2a75 100644 --- a/fri/server/main.py +++ b/fri/server/main.py @@ -67,17 +67,21 @@ def upload(dir): def build(dir): graphml_file = request.args.get('fetch') apikey = request.args.get('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): if(platform.uname()[0]=='Windows'): - proc= call(["makestudy", makestudy_dir], shell=True, cwd=concore_path) + proc= call(["makestudy", makestudy_dir, out_dir], shell=True, cwd=concore_path) else: - proc = call(["./makestudy", makestudy_dir], cwd=concore_path) + proc = call(["./makestudy", makestudy_dir, out_dir], cwd=concore_path) if(proc == 0): resp = jsonify({'message': 'Directory successfully created'}) resp.status_code = 201 From 5368ba2529e6ed28f3d5e8e2c768960142d9931e Mon Sep 17 00:00:00 2001 From: Rahul Date: Thu, 23 Feb 2023 14:58:56 +0530 Subject: [PATCH 2/3] destroy was giving error --- fri/test.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fri/test.py b/fri/test.py index 8204c68..7f29458 100644 --- a/fri/test.py +++ b/fri/test.py @@ -16,8 +16,8 @@ def upload(files): # # ******* # function to check build -def build(dir, graphml, apikey): - url = "http://127.0.0.1:5000/build/"+dir+"?"+"fetch="+graphml+"&"+"apikey="+apikey +def build(dir, graphml, outdir, apikey): + url = "http://127.0.0.1:5000/build/"+dir+"?"+"fetch="+graphml+"&"+"outdir="+outdir+"&"+"apikey="+apikey response = requests.request("POST", url) print(response.text) @@ -83,20 +83,20 @@ def download(dir, subDir, fileName , apikey ): upload(files) time.sleep(2) -build("test", "sample", "xyz") +build("test", "sample", "sample-anyname", "xyz") time.sleep(6) method = input("methods - 1 for debug, 0 for run :") if method == "1": - debug("sample", "xyz") + debug("sample-anyname", "xyz") else: - run("sample", "xyz") + run("sample-anyname", "xyz") time.sleep(2) -stop("sample", "xyz") +stop("sample-anyname", "xyz") time.sleep(2) -getFilesList("xyz", "sample", "CU") -getFilesList("xyz","sample", "PYM") +getFilesList("xyz", "sample-anyname", "CU") +getFilesList("xyz","sample-anyname", "PYM") time.sleep(5) -download("sample", "CU", "u", "xyz") -clear("sample", "xyz") -destroy("sample", "xyz") +download("sample-anyname", "CU", "u", "xyz") +clear("sample-anyname", "xyz") +destroy("sample-anyname", "xyz") openJupyter() From b7403da133ee93c38ed45f337ab6c40a1935114e Mon Sep 17 00:00:00 2001 From: Rahul Date: Thu, 23 Feb 2023 15:15:59 +0530 Subject: [PATCH 3/3] if else check for outdir --- fri/server/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fri/server/main.py b/fri/server/main.py index 48e2a75..89c93f4 100644 --- a/fri/server/main.py +++ b/fri/server/main.py @@ -79,9 +79,15 @@ def build(dir): dir_path = os.path.abspath(os.path.join(concore_path, out_dir)) #path for ./build if not os.path.exists(dir_path): if(platform.uname()[0]=='Windows'): - proc= call(["makestudy", makestudy_dir, out_dir], shell=True, cwd=concore_path) + 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: - proc = call(["./makestudy", makestudy_dir, out_dir], cwd=concore_path) + 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