Skip to content

Commit

Permalink
add delete/cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
romaric-g committed Jun 12, 2021
1 parent 94e0315 commit 7c48831
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 29 deletions.
15 changes: 15 additions & 0 deletions Patent2Net/app/dex.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ def set_done(directory):

write_dex()


def delete_request(directory):
in_progress = dex["in_progress"]
done = dex["done"]
requests = dex["requests"]

if directory in in_progress:
in_progress.remove(directory)
if directory in in_progress:
done.remove(directory)
if directory in requests:
del requests[directory]

write_dex()

# DATA

def set_directory_request_data(directory, key, value):
Expand Down
32 changes: 31 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import asyncio
import epo_ops

from Patent2Net.app.dex import get_current_dex, read_dex, set_in_progress, set_done, set_data_progress, get_data_progress, get_global_progress, set_state, get_state, get_directory_request_data_all, delete_data_to_be_found, get_data_to_be_found, set_data_spliter_start_date, delete_data_spliter
from Patent2Net.app.dex import get_current_dex, read_dex, set_in_progress, set_done, set_data_progress, get_data_progress, get_global_progress, set_state, get_state, get_directory_request_data_all, delete_data_to_be_found, get_data_to_be_found, set_data_spliter_start_date, delete_data_spliter, delete_request
from Patent2Net.app.events.progress_value_change import ProgressValueChange
from Patent2Net.app.events.to_be_found_change import ToBeFoundChange
from Patent2Net.app.events.split_end import SplitEnd
Expand Down Expand Up @@ -284,6 +284,11 @@ def post_request():
p2n_options = form_result['p2n_options'].split(',')
p2n_auto = 'p2n_auto' in form_result and form_result['p2n_auto'] == "true"

dex = get_current_dex()

if p2n_dir in dex['in_progress'] or p2n_dir in dex['done']:
return get_error_response(p2n_dir + " is already use")

#Pleaceholder file who give the model of the file
f_in = open("placeholder.cql", "rt")

Expand Down Expand Up @@ -416,6 +421,31 @@ def update_one_request_interface(p2n_dir):
"directory": p2n_dir
})

@app.route('/api/v1/requests/<p2n_dir>', methods=['DELETE'])
def delete_one_request_result(p2n_dir):
print(p2n_dir)

import os
data = [(int(p), c) for p, c in [x.rstrip('\n').split(' ', 1) \
for x in os.popen('ps h -eo pid:1,command')]]

for d in data:
print(str(d[0]) + ' - ' + d[1])
if ('RequestsSets/' + p2n_dir + '.cql') in d[1] or ('RequestsAuto/' + p2n_dir + '/') in d[1]:
print('kill')
os.popen('kill -9 ' + str(d[0]))

if os.path.exists("RequestsSets/" + p2n_dir + ".cql"):
os.remove("RequestsSets/" + p2n_dir + ".cql")

delete_request(p2n_dir)

return get_success_response("OK", {})





@app.route('/api/v1/events', methods=['POST'])
def events():
"""
Expand Down
26 changes: 13 additions & 13 deletions web_app/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"files": {
"main.css": "/app/static/css/main.fd5c3e28.chunk.css",
"main.js": "/app/static/js/main.88ea6b9f.chunk.js",
"main.js.map": "/app/static/js/main.88ea6b9f.chunk.js.map",
"runtime-main.js": "/app/static/js/runtime-main.f6be42b7.js",
"runtime-main.js.map": "/app/static/js/runtime-main.f6be42b7.js.map",
"static/js/2.3af01b63.chunk.js": "/app/static/js/2.3af01b63.chunk.js",
"static/js/2.3af01b63.chunk.js.map": "/app/static/js/2.3af01b63.chunk.js.map",
"main.css": "/app/static/css/main.8a75f1d1.chunk.css",
"main.js": "/app/static/js/main.85f1acfb.chunk.js",
"main.js.map": "/app/static/js/main.85f1acfb.chunk.js.map",
"runtime-main.js": "/app/static/js/runtime-main.8dd6bcea.js",
"runtime-main.js.map": "/app/static/js/runtime-main.8dd6bcea.js.map",
"static/js/2.dc7f60bb.chunk.js": "/app/static/js/2.dc7f60bb.chunk.js",
"static/js/2.dc7f60bb.chunk.js.map": "/app/static/js/2.dc7f60bb.chunk.js.map",
"index.html": "/app/index.html",
"static/css/main.fd5c3e28.chunk.css.map": "/app/static/css/main.fd5c3e28.chunk.css.map",
"static/js/2.3af01b63.chunk.js.LICENSE.txt": "/app/static/js/2.3af01b63.chunk.js.LICENSE.txt"
"static/css/main.8a75f1d1.chunk.css.map": "/app/static/css/main.8a75f1d1.chunk.css.map",
"static/js/2.dc7f60bb.chunk.js.LICENSE.txt": "/app/static/js/2.dc7f60bb.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.f6be42b7.js",
"static/js/2.3af01b63.chunk.js",
"static/css/main.fd5c3e28.chunk.css",
"static/js/main.88ea6b9f.chunk.js"
"static/js/runtime-main.8dd6bcea.js",
"static/js/2.dc7f60bb.chunk.js",
"static/css/main.8a75f1d1.chunk.css",
"static/js/main.85f1acfb.chunk.js"
]
}
2 changes: 1 addition & 1 deletion web_app/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/app/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/app/logo192.png"/><link rel="manifest" href="/app/manifest.json"/><title>Request App</title><link href="https://unpkg.com/tailwindcss@^1.4.6/dist/tailwind.min.css" rel="stylesheet"><link href="/app/static/css/main.fd5c3e28.chunk.css" rel="stylesheet"></head><body class="w-max"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" class="w-max min-h-screen bg-gray-100"></div><script>!function(e){function r(r){for(var n,p,a=r[0],l=r[1],f=r[2],c=0,s=[];c<a.length;c++)p=a[c],Object.prototype.hasOwnProperty.call(o,p)&&o[p]&&s.push(o[p][0]),o[p]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var l=t[a];0!==o[l]&&(n=!1)}n&&(u.splice(r--,1),e=p(p.s=t[0]))}return e}var n={},o={1:0},u=[];function p(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,p),t.l=!0,t.exports}p.m=e,p.c=n,p.d=function(e,r,t){p.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},p.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.t=function(e,r){if(1&r&&(e=p(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(p.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)p.d(t,n,function(r){return e[r]}.bind(null,n));return t},p.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(r,"a",r),r},p.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},p.p="/app/";var a=this.webpackJsonprequest_app=this.webpackJsonprequest_app||[],l=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=l;t()}([])</script><script src="/app/static/js/2.3af01b63.chunk.js"></script><script src="/app/static/js/main.88ea6b9f.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/app/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/app/logo192.png"/><link rel="manifest" href="/app/manifest.json"/><title>Request App</title><link href="https://unpkg.com/tailwindcss@^1.4.6/dist/tailwind.min.css" rel="stylesheet"><link href="/app/static/css/main.8a75f1d1.chunk.css" rel="stylesheet"></head><body class="w-max"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" class="w-max min-h-screen bg-gray-100"></div><script>!function(e){function r(r){for(var n,p,a=r[0],l=r[1],f=r[2],c=0,s=[];c<a.length;c++)p=a[c],Object.prototype.hasOwnProperty.call(o,p)&&o[p]&&s.push(o[p][0]),o[p]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var l=t[a];0!==o[l]&&(n=!1)}n&&(u.splice(r--,1),e=p(p.s=t[0]))}return e}var n={},o={1:0},u=[];function p(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,p),t.l=!0,t.exports}p.m=e,p.c=n,p.d=function(e,r,t){p.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},p.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.t=function(e,r){if(1&r&&(e=p(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(p.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)p.d(t,n,function(r){return e[r]}.bind(null,n));return t},p.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(r,"a",r),r},p.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},p.p="/app/";var a=this.webpackJsonprequest_app=this.webpackJsonprequest_app||[],l=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=l;t()}([])</script><script src="/app/static/js/2.dc7f60bb.chunk.js"></script><script src="/app/static/js/main.85f1acfb.chunk.js"></script></body></html>
2 changes: 2 additions & 0 deletions web_app/build/static/css/main.8a75f1d1.chunk.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web_app/build/static/css/main.8a75f1d1.chunk.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions web_app/build/static/css/main.fd5c3e28.chunk.css

This file was deleted.

1 change: 0 additions & 1 deletion web_app/build/static/css/main.fd5c3e28.chunk.css.map

This file was deleted.

1 change: 0 additions & 1 deletion web_app/build/static/js/2.3af01b63.chunk.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web_app/build/static/js/2.dc7f60bb.chunk.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web_app/build/static/js/main.85f1acfb.chunk.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion web_app/build/static/js/main.88ea6b9f.chunk.js.map

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7c48831

Please sign in to comment.