Commit c883fbea authored by Davide Lagoa's avatar Davide Lagoa
Browse files

update method created

parent 7383c0a6
......@@ -2,9 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="87f3b13d-58c3-4a2e-acf3-4ed7fa387d7f" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/code/manager.py" beforeDir="false" afterPath="$PROJECT_DIR$/code/manager.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/code/tests.py" beforeDir="false" afterPath="$PROJECT_DIR$/code/tests.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/code/workersManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/code/workersManager.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/configs/docker_config.conf" beforeDir="false" afterPath="$PROJECT_DIR$/configs/docker_config.conf" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -13,12 +15,12 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/code/manager.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1478">
<caret line="293" column="9" lean-forward="true" selection-start-line="293" selection-start-column="9" selection-end-line="293" selection-end-column="9" />
<state relative-caret-position="495">
<caret line="293" column="9" selection-start-line="293" selection-start-column="9" selection-end-line="293" selection-end-column="9" />
<folding>
<element signature="e#24#93#0" expanded="true" />
</folding>
......@@ -29,8 +31,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/code/workersManager.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1171">
<caret line="150" column="16" selection-start-line="150" selection-start-column="16" selection-end-line="150" selection-end-column="16" />
<state relative-caret-position="109">
<caret line="221" column="80" selection-start-line="221" selection-start-column="80" selection-end-line="221" selection-end-column="80" />
<folding>
<element signature="e#0#65#0" expanded="true" />
</folding>
......@@ -41,47 +43,17 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/configs/docker_config.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="233">
<caret line="31" lean-forward="true" selection-start-line="31" selection-end-line="31" />
<state relative-caret-position="460">
<caret line="48" column="21" selection-start-line="48" selection-start-column="10" selection-end-line="48" selection-end-column="21" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/configs/workers_addresses.conf">
<entry file="file://$PROJECT_DIR$/code/tests.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="32" selection-start-line="3" selection-start-column="32" selection-end-line="3" selection-end-column="32" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/code/templates/home.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="332">
<caret line="216" column="79" lean-forward="true" selection-start-line="216" selection-start-column="62" selection-end-line="216" selection-end-column="79" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/code/test_html.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-9">
<caret line="65" lean-forward="true" selection-start-line="65" selection-end-line="65" />
<folding>
<element signature="e#24#93#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/code/static/js/show_number_slider.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<caret line="75" column="9" selection-start-line="75" selection-start-column="9" selection-end-line="75" selection-end-column="9" />
<state relative-caret-position="60">
<caret line="4" column="15" lean-forward="true" selection-start-line="4" selection-start-column="15" selection-end-line="4" selection-end-column="15" />
</state>
</provider>
</entry>
......@@ -105,6 +77,8 @@
<find>?</find>
<find>params</find>
<find>genome</find>
<find>gl</find>
<find>host</find>
</findStrings>
</component>
<component name="Git.Settings">
......@@ -121,8 +95,9 @@
<option value="$PROJECT_DIR$/code/test_html.py" />
<option value="$PROJECT_DIR$/code/templates/home.html" />
<option value="$PROJECT_DIR$/configs/workers_addresses.conf" />
<option value="$PROJECT_DIR$/code/tests.py" />
<option value="$PROJECT_DIR$/code/manager.py" />
<option value="$PROJECT_DIR$/code/tests.py" />
<option value="$PROJECT_DIR$/configs/docker_config.conf" />
<option value="$PROJECT_DIR$/code/workersManager.py" />
</list>
</option>
......@@ -159,6 +134,12 @@
<item name="transyt-manager-docker" type="462c0819:PsiDirectoryNode" />
<item name="code" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="transyt-manager-docker" type="b2602c69:ProjectViewProjectNode" />
<item name="transyt-manager-docker" type="462c0819:PsiDirectoryNode" />
<item name="code" type="462c0819:PsiDirectoryNode" />
<item name="static" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="transyt-manager-docker" type="b2602c69:ProjectViewProjectNode" />
<item name="transyt-manager-docker" type="462c0819:PsiDirectoryNode" />
......@@ -265,7 +246,7 @@
<editor active="true" />
<layout>
<window_info id="Favorites" order="0" side_tool="true" />
<window_info content_ui="combo" id="Project" order="1" visible="true" weight="0.17156473" />
<window_info active="true" content_ui="combo" id="Project" order="1" visible="true" weight="0.17156473" />
<window_info id="Structure" order="2" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Terminal" order="0" />
<window_info anchor="bottom" id="Event Log" order="1" side_tool="true" />
......@@ -273,7 +254,7 @@
<window_info anchor="bottom" id="Message" order="3" />
<window_info anchor="bottom" id="Find" order="4" />
<window_info anchor="bottom" id="Version Control" order="5" />
<window_info active="true" anchor="bottom" id="Run" order="6" visible="true" weight="0.32876712" />
<window_info anchor="bottom" id="Run" order="6" visible="true" weight="0.21643835" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.22876713" />
<window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
......@@ -294,22 +275,48 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/static/js/show_filename.js">
<provider selected="true" editor-type-id="text-editor" />
<entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/_pydev_imps/_pydev_execfile.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" selection-start-line="17" selection-end-line="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/accordion_results.css">
<provider selected="true" editor-type-id="text-editor" />
<entry file="file://$PROJECT_DIR$/code/templates/home.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3240">
<caret line="216" column="79" selection-start-line="216" selection-start-column="62" selection-end-line="216" selection-end-column="79" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/center.css">
<entry file="file://$PROJECT_DIR$/code/test_html.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1003" />
<state relative-caret-position="960">
<caret line="65" selection-start-line="65" selection-end-line="65" />
<folding>
<element signature="e#24#93#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/submit.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="570">
<caret line="284" column="34" selection-start-line="284" selection-start-column="34" selection-end-line="284" selection-end-column="34" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/footer.css">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/accordion_results.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-133" />
<state relative-caret-position="-4886" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/center.css">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/collapsible.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
......@@ -324,51 +331,29 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/static/css/submit.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="478">
<caret line="284" column="34" selection-start-line="284" selection-start-column="34" selection-end-line="284" selection-end-column="34" />
</state>
</provider>
<entry file="file://$PROJECT_DIR$/code/static/js/show_filename.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/code/static/js/show_number_slider.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<state relative-caret-position="573">
<caret line="75" column="9" selection-start-line="75" selection-start-column="9" selection-end-line="75" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/_pydev_imps/_pydev_execfile.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" selection-start-line="17" selection-end-line="17" />
</state>
</provider>
<entry file="file://$PROJECT_DIR$/code/static/js/to_show.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/code/test_html.py">
<entry file="file://$PROJECT_DIR$/code/manager.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-9">
<caret line="65" lean-forward="true" selection-start-line="65" selection-end-line="65" />
<state relative-caret-position="495">
<caret line="293" column="9" selection-start-line="293" selection-start-column="9" selection-end-line="293" selection-end-column="9" />
<folding>
<element signature="e#24#93#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/templates/home.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="332">
<caret line="216" column="79" lean-forward="true" selection-start-line="216" selection-start-column="62" selection-end-line="216" selection-end-column="79" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/configs/docker_config.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="233">
<caret line="31" lean-forward="true" selection-start-line="31" selection-end-line="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/configs/workers_addresses.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
......@@ -378,28 +363,22 @@
</entry>
<entry file="file://$PROJECT_DIR$/code/tests.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="23" selection-start-line="23" selection-end-line="23" />
<folding>
<element signature="e#0#9#0" expanded="true" />
</folding>
<state relative-caret-position="60">
<caret line="4" column="15" lean-forward="true" selection-start-line="4" selection-start-column="15" selection-end-line="4" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/manager.py">
<entry file="file://$PROJECT_DIR$/configs/docker_config.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1478">
<caret line="293" column="9" lean-forward="true" selection-start-line="293" selection-start-column="9" selection-end-line="293" selection-end-column="9" />
<folding>
<element signature="e#24#93#0" expanded="true" />
</folding>
<state relative-caret-position="460">
<caret line="48" column="21" selection-start-line="48" selection-start-column="10" selection-end-line="48" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/code/workersManager.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1171">
<caret line="150" column="16" selection-start-line="150" selection-start-column="16" selection-end-line="150" selection-end-column="16" />
<state relative-caret-position="109">
<caret line="221" column="80" selection-start-line="221" selection-start-column="80" selection-end-line="221" selection-end-column="80" />
<folding>
<element signature="e#0#65#0" expanded="true" />
</folding>
......
import re
from transyt_request import get_reaction_data
import datetime
def reactions(reactionId):
current_day = datetime.datetime.today().day
update_day = 2
updated = False
url = "bolt://palsson.di.uminho.pt:7687"
user = "neo4j"
password = "password"
pattern = re.compile("^T[A-Z]\d{7}")
patternFound = bool(pattern.match(reactionId))
if patternFound:
results_dict = get_reaction_data(reactionId, url, user, password)
if results_dict:
print(results_dict)
#return render_template("record.html", subId=reactionId, dictt=results_dict), 200
else:
print("NOTHING FOUND!!")
#return render_template("noresutls.html", subId=reactionId), 200
#reactions("TI0000009")
if current_day == update_day and not updated:
updated = True
else:
updated = False
......@@ -6,7 +6,10 @@ import os
import requests
import shutil
import subprocess
import datetime
UPDATE_DAY = 2
UPDATED = None
CONFIGURATIONS = read_conf_file('/configs/docker_config.conf')
CONFIGURATIONS_WORKERS = read_workers_conf_file('/configs/workers_addresses.conf')
......@@ -109,6 +112,7 @@ def run():
if os.path.exists(path):
shutil.rmtree(path)
check_if_update_day()
time.sleep(5)
def checkSubmissionsStatus(mapping):
......@@ -211,6 +215,31 @@ def cleanResultsDirectory():
shutil.rmtree(PROCESSING_PATH + directoryID, ignore_errors=True)
results.remove(directoryID)
def check_if_update_day():
"""
This update method is set to one day after the cronjob to generate a new data version rather than checking if
a new hash key was generated in order to avoid constant requests to merlin's website
"""
global UPDATED
current_day = datetime.datetime.today().day
if UPDATED is None or current_day == UPDATE_DAY and not UPDATED:
if UPDATED is None:
# time for workers to get online
time.sleep(20)
for host in CONFIGURATIONS_WORKERS:
logger.info("Updating host -> " + host)
res = requests.get(host + CONFIGURATIONS.get('update_data'))
logger.info("Update result response code: " + str(res.status_code) + "; " + str(res.content))
UPDATED = True
else:
#When update day ends, boolean to false. this prevents multiple uptade orders on the same day
UPDATED = False
if __name__ == '__main__':
logger.info("Starting server!")
subprocess.Popen(["python", "/home/manager.py"])
......
......@@ -44,3 +44,6 @@ dbusername = neo4j
#19 - database password
dbpassword = password
#20 - update worker data
update = /update_data
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment