python /home/admin/mtr/script_for_cron.py -j datou_current3 -m 20 -a ' -a 4302 -v ' -s datou_current_4302 -M 0 -S 0 -U 95,95,120 import MySQLdb succeeded Import error (python version) ['/Users/moilerat/Documents/Fotonower/install/caffe/distribute/python', '/home/admin/workarea/git/Velours/python/prod', '/home/admin/workarea/install/caffe_cuda8_python3/python', '/home/admin/workarea/install/darknet', '/home/admin/workarea/git/Velours/python', '/home/admin/workarea/install/caffe_frcnn_python3/py-faster-rcnn/caffe-fast-rcnn/python', '/home/admin/mtr/.credentials', '/home/admin/workarea/install/caffe/python', '/home/admin/workarea/install/caffe_frcnn/py-faster-rcnn/tools', '/home/admin/workarea/git/fotonowerpip', '/home/admin/workarea/install/segment-anything', '/home/admin/workarea/git/pyfvs', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/admin/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages'] Namespace(auto=False, cert_args='/home/fotonower/https/cert.pem', contextDataFile='', custom_size=0, database='', datou_id='4302', datou_id_excluded='', fifo=False, host='', is_cpu_mode=False, job='batch_current', json_args='', key_args='/home/fotonower/https/vision.fotonower.com.key', limit=1000, list_photo_ids='', local='', mtr_current_id=0, mtr_portfolio_ids='', nb_thread=1, no_current=False, offset=0, only_client=False, output_file='', password='', port=5100, rand=0, save=2, use_client=False, user_id=440, username='', verbose=True) process id : 2732847 load datou : 4302 # VR 17-11-17 : to create in DB ! Here we check the datou graph and we reorder steps ! Tree builded and cycle checked, now we need to re-order the steps ! We have currenlty an error because there is no dependence between the last step for the case tile - detect - glue We can either keep the depence of, it is better to keep an order compatible with the id of steps if we do not have sons, so a lexical order : (number_son, step_id) All sons are already in current list ! All sons are already in current list ! All sons are already in current list ! All sons are already in current list ! DONE and to test : checkNoCycle ! Here we check the consistency of inputs/outputs number between the given ones and the db ! eke 1-6-18 : checkConsistencyNbInputNbOutput should be processed after step reordering ! WARNING : number of outputs for step 13596 ventilate_hashtags_in_portfolio is not consistent : 2 used against 1 in the step definition ! Step 11881 final have less inputs used (1) than in the step definition (3) : maybe we manage optionnal inputs ! Step 11881 final have less outputs used (1) than in the step definition (2) : some outputs may be not used ! WARNING : number of outputs for step 13625 velours_tree is not consistent : 2 used against 1 in the step definition ! Step 11884 send_mail_cod have less inputs used (3) than in the step definition (5) : maybe we manage optionnal inputs ! Number of inputs / outputs for each step checked ! Here we check the consistency of outputs/inputs types during steps connections eke 1-6-18 : checkConsistencyTypeOutputInput should be processed after checkConsistencyNbInputNbOutput ! We ignore checkConsistencyTypeOutputInput for datou_step final ! WARNING : output 0 of step 13596 have datatype=10 whereas input 3 of step 11884 have datatype=6 WARNING : type of output 1 of step 13596 doesn't seem to be define in the database( WARNING : type of input 3 of step 11881 doesn't seem to be define in the database( We ignore checkConsistencyTypeOutputInput for datou_step final ! WARNING : output 0 of step 13596 have datatype=10 whereas input 0 of step 13625 have datatype=18 WARNING : type of output 1 of step 13625 doesn't seem to be define in the database( WARNING : type of input 5 of step 11884 doesn't seem to be define in the database( DataTypes for each output/input checked ! Unexpected type seems boolean for variable list_input_json ERROR or WARNING : can't parse json string Expecting value: line 1 column 1 (char 0) Tried to parse : None was removed should we ? donnée sous forme de texte was removed should we ? (photo_id, hashtag_id, score_max) was removed should we ? id de la photo (peut être local ou global) was removed should we ? donnée sous forme de texte was removed should we ? donnée sous forme de texte was removed should we ? donnée sous forme de texte was removed should we ? None was removed should we ? donnée sous forme de nombre was removed should we ? (photo_id, hashtag_id, score_max) was removed should we ? (photo_id, hashtag_id, score_max) was removed should we ? (photo_id, hashtag_id, score_max) was removed should we ? (photo_id, hashtag_id, score_max) was removed should we ? (photo_id, hashtag_id, score_max) was removed should we ? donnée sous forme de texte was removed should we ? None was removed should we ? donnée sous forme de texte was removed should we ? [ptf_id0,ptf_id1...] was removed should we ? load thcls load pdts Running datou job : batch_current 4302 [] TODO datou_current to load to do maybe to take outside batchDatouExec SELECT * from MTRPhoto.mtr_datou_current where state = 0 AND mtr_portfolio_id is not NULL AND mtd_id = 4302 order by created_at desc LIMIT 1 UPDATE MTRPhoto.mtr_datou_current SET state=1, hostname='marlene' WHERE id in (3935031) updating current state to 1 UPDATE MTRPhoto.mtr_datou_current SET state=1, hostname='marlene' WHERE id in (3935031) SELECT count(*) from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770028 AND hide_status = 0 list_input_json: [] Current got : datou_id : 4302, datou_cur_ids : ['3935031'] with mtr_portfolio_ids : ['27770028'] and first list_photo_ids : [] new path : /proc/2732847/ Name: python3 Umask: 0002 State: R (running) Tgid: 2732847 Ngid: 0 Pid: 2732847 PPid: 2732846 TracerPid: 0 Uid: 1006 1006 1006 1006 Gid: 1009 1009 1009 1009 FDSize: 64 Groups: 27 1009 1026 NStgid: 2732847 NSpid: 2732847 NSpgid: 2732157 NSsid: 2732157 VmPeak: 1106868 kB VmSize: 1106868 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 98032 kB VmRSS: 98032 kB RssAnon: 59844 kB RssFile: 38188 kB RssShmem: 0 kB VmData: 865620 kB VmStk: 132 kB VmExe: 2644 kB VmLib: 130468 kB VmPTE: 560 kB VmSwap: 0 kB HugetlbPages: 0 kB CoreDumping: 0 THP_enabled: 1 Threads: 1 SigQ: 0/63019 SigPnd: 0000000000000000 ShdPnd: 0000000000000000 SigBlk: 0000000000000000 SigIgn: 0000000001001000 SigCgt: 0000000180000002 CapInh: 0000000000000000 CapPrm: 0000000000000000 CapEff: 0000000000000000 CapBnd: 000001ffffffffff CapAmb: 0000000000000000 NoNewPrivs: 0 Seccomp: 0 Seccomp_filters: 0 Speculation_Store_Bypass: thread vulnerable SpeculationIndirectBranch: conditional enabled Cpus_allowed: ffffffff,ffffffff,ffffffff,ffffffff Cpus_allowed_list: 0-127 Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001 Mems_allowed_list: 0 voluntary_ctxt_switches: 47 nonvoluntary_ctxt_switches: 159 {'Name': 'python3', 'Umask': '0002', 'State': 'R (running)', 'Tgid': '2732847', 'Ngid': '0', 'Pid': '2732847', 'PPid': '2732846', 'TracerPid': '0', 'Uid': '1006,1006,1006,1006', 'Gid': '1009,1009,1009,1009', 'FDSize': '64', 'Groups': '27 1009 1026', 'NStgid': '2732847', 'NSpid': '2732847', 'NSpgid': '2732157', 'NSsid': '2732157', 'VmPeak': '1106868 kB', 'VmSize': '1106868 kB', 'VmLck': '0 kB', 'VmPin': '0 kB', 'VmHWM': '98032 kB', 'VmRSS': '98032 kB', 'RssAnon': '59844 kB', 'RssFile': '38188 kB', 'RssShmem': '0 kB', 'VmData': '865620 kB', 'VmStk': '132 kB', 'VmExe': '2644 kB', 'VmLib': '130468 kB', 'VmPTE': '560 kB', 'VmSwap': '0 kB', 'HugetlbPages': '0 kB', 'CoreDumping': '0', 'THP_enabled': '1', 'Threads': '1', 'SigQ': '0/63019', 'SigPnd': '0000000000000000', 'ShdPnd': '0000000000000000', 'SigBlk': '0000000000000000', 'SigIgn': '0000000001001000', 'SigCgt': '0000000180000002', 'CapInh': '0000000000000000', 'CapPrm': '0000000000000000', 'CapEff': '0000000000000000', 'CapBnd': '000001ffffffffff', 'CapAmb': '0000000000000000', 'NoNewPrivs': '0', 'Seccomp': '0', 'Seccomp_filters': '0', 'Speculation_Store_Bypass': 'thread vulnerable', 'SpeculationIndirectBranch': 'conditional enabled', 'Cpus_allowed': 'ffffffff,ffffffff,ffffffff,ffffffff', 'Cpus_allowed_list': '0-127', 'Mems_allowed': '00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001', 'Mems_allowed_list': '0', 'voluntary_ctxt_switches': '47', 'nonvoluntary_ctxt_switches': '159'} ('datou_batch_current', '2732847', '1106868', '0', '1106868', '865620', '98032', b'', 'marlene', '3935031') insert ignore into MTRAdmin.mem_info (script_name, PID, VMpeak,VMswap,VMsize,VMdata,VMrss,GPU_ram, hostname, mtr_current_id) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) Inside batchDatouExec : verbose : True ##### chargement datou SELECT name, created_at,limit_max FROM MTRDatou.mtr_datou WHERE id=4302 SELECT mtd.id, mtdt.`type`, mtd.`param`, mtd.param_json, mtdt.nb_input, mtdt.nb_output, mtdt.prod, mtdt.is_local, mtdt.is_datou_depend, mtdt.is_photo_id_local FROM MTRDatou.mtr_datou_step mtd, MTRDatou.mtr_datou_step_types mtdt WHERE mtdt.`id`=mtd.`type` AND mtd.mtd_id=4302 SELECT mtd.id, mtd.mtd_id, mdsdt.id, mdsdt.name, mdsdt.description, msid.output_or_input, msid.data_order_id, mdsdt.type FROM MTRDatou.mtr_datou_step mtd, MTRDatou.mtr_datou_steptype_io_datatypes msid, MTRDatou.mtr_datou_step_data_types mdsdt WHERE mtd.`type`=msid.`mtr_datou_step_type` AND mtd.mtd_id= 4302 AND msid.data_type=mdsdt.id SELECT mts_id_output, id_output, mts_id_input, id_input FROM MTRDatou.mtr_datou_step_by_step WHERE mtd_id=4302 # VR 17-11-17 : to create in DB ! Here we check the datou graph and we reorder steps ! Tree builded and cycle checked, now we need to re-order the steps ! We have currenlty an error because there is no dependence between the last step for the case tile - detect - glue We can either keep the depence of, it is better to keep an order compatible with the id of steps if we do not have sons, so a lexical order : (number_son, step_id) All sons are already in current list ! All sons are already in current list ! All sons are already in current list ! All sons are already in current list ! DONE and to test : checkNoCycle ! Here we check the consistency of inputs/outputs number between the given ones and the db ! eke 1-6-18 : checkConsistencyNbInputNbOutput should be processed after step reordering ! WARNING : number of outputs for step 13596 ventilate_hashtags_in_portfolio is not consistent : 2 used against 1 in the step definition ! Step 11881 final have less inputs used (1) than in the step definition (3) : maybe we manage optionnal inputs ! Step 11881 final have less outputs used (1) than in the step definition (2) : some outputs may be not used ! WARNING : number of outputs for step 13625 velours_tree is not consistent : 2 used against 1 in the step definition ! Step 11884 send_mail_cod have less inputs used (3) than in the step definition (5) : maybe we manage optionnal inputs ! Number of inputs / outputs for each step checked ! Here we check the consistency of outputs/inputs types during steps connections eke 1-6-18 : checkConsistencyTypeOutputInput should be processed after checkConsistencyNbInputNbOutput ! We ignore checkConsistencyTypeOutputInput for datou_step final ! WARNING : output 0 of step 13596 have datatype=10 whereas input 3 of step 11884 have datatype=6 WARNING : type of output 1 of step 13596 doesn't seem to be define in the database( WARNING : type of input 3 of step 11881 doesn't seem to be define in the database( We ignore checkConsistencyTypeOutputInput for datou_step final ! WARNING : output 0 of step 13596 have datatype=10 whereas input 0 of step 13625 have datatype=18 WARNING : type of output 1 of step 13625 doesn't seem to be define in the database( WARNING : type of input 5 of step 11884 doesn't seem to be define in the database( DataTypes for each output/input checked ! no param json to modify List Step Type Loaded in datou : ventilate_hashtags_in_portfolio, final, velours_tree, send_mail_cod, split_time_score over limit max, limiting to limit_max 200 list_input_json : [] ##### fin chargement datou ##### chargement data ##### Call load_data_input : nb_thread : 1 origin SELECT ph.photo_id, ph.url FROM MTRBack.photos_view ph WHERE ph.photo_id IN (SELECT mtr_photo_id from MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id in (27770028) and hide_status = 0 ) AND ph.photo_id not in (SELECT mtr_photo_id from MTRPhoto.mtr_datou_result_search where mtr_current_id in (3935031 ) ) ORDER BY ph.photo_id DESC LIMIT 0, 200 We have 1 , {} SELECT mtr_photo_id, mtr_portfolio_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id in (27770028) AND hide_status = 0 ORDER by mtr_photo_id desc LIMIT 0, 200 list_result: [{'photo_id': 1389275854, 'portfolio_id': 27770028}, {'photo_id': 1389275837, 'portfolio_id': 27770028}, {'photo_id': 1389275831, 'portfolio_id': 27770028}, {'photo_id': 1389275829, 'portfolio_id': 27770028}, {'photo_id': 1389275828, 'portfolio_id': 27770028}, {'photo_id': 1389275826, 'portfolio_id': 27770028}, {'photo_id': 1389275660, 'portfolio_id': 27770028}, {'photo_id': 1389275551, 'portfolio_id': 27770028}, {'photo_id': 1389275550, 'portfolio_id': 27770028}, {'photo_id': 1389275549, 'portfolio_id': 27770028}, {'photo_id': 1389275234, 'portfolio_id': 27770028}, {'photo_id': 1389275232, 'portfolio_id': 27770028}, {'photo_id': 1389275228, 'portfolio_id': 27770028}, {'photo_id': 1389275226, 'portfolio_id': 27770028}, {'photo_id': 1389275225, 'portfolio_id': 27770028}, {'photo_id': 1389275218, 'portfolio_id': 27770028}, {'photo_id': 1389275168, 'portfolio_id': 27770028}, {'photo_id': 1389275166, 'portfolio_id': 27770028}, {'photo_id': 1389275165, 'portfolio_id': 27770028}, {'photo_id': 1389275164, 'portfolio_id': 27770028}, {'photo_id': 1389274995, 'portfolio_id': 27770028}, {'photo_id': 1389274992, 'portfolio_id': 27770028}, {'photo_id': 1389274991, 'portfolio_id': 27770028}, {'photo_id': 1389274814, 'portfolio_id': 27770028}, {'photo_id': 1389274812, 'portfolio_id': 27770028}, {'photo_id': 1389274528, 'portfolio_id': 27770028}, {'photo_id': 1389274524, 'portfolio_id': 27770028}, {'photo_id': 1389274522, 'portfolio_id': 27770028}, {'photo_id': 1389274521, 'portfolio_id': 27770028}, {'photo_id': 1389274519, 'portfolio_id': 27770028}, {'photo_id': 1389274127, 'portfolio_id': 27770028}, {'photo_id': 1389274126, 'portfolio_id': 27770028}, {'photo_id': 1389274125, 'portfolio_id': 27770028}, {'photo_id': 1389274123, 'portfolio_id': 27770028}, {'photo_id': 1389274117, 'portfolio_id': 27770028}, {'photo_id': 1389273861, 'portfolio_id': 27770028}, {'photo_id': 1389273272, 'portfolio_id': 27770028}, {'photo_id': 1389273181, 'portfolio_id': 27770028}, {'photo_id': 1389273064, 'portfolio_id': 27770028}, {'photo_id': 1389273063, 'portfolio_id': 27770028}, {'photo_id': 1389273041, 'portfolio_id': 27770028}, {'photo_id': 1389273039, 'portfolio_id': 27770028}, {'photo_id': 1389273038, 'portfolio_id': 27770028}, {'photo_id': 1389273034, 'portfolio_id': 27770028}, {'photo_id': 1389273024, 'portfolio_id': 27770028}, {'photo_id': 1389273022, 'portfolio_id': 27770028}, {'photo_id': 1389273020, 'portfolio_id': 27770028}, {'photo_id': 1389273017, 'portfolio_id': 27770028}, {'photo_id': 1389273013, 'portfolio_id': 27770028}, {'photo_id': 1389273010, 'portfolio_id': 27770028}, {'photo_id': 1389272964, 'portfolio_id': 27770028}, {'photo_id': 1389272956, 'portfolio_id': 27770028}, {'photo_id': 1389272953, 'portfolio_id': 27770028}, {'photo_id': 1389272949, 'portfolio_id': 27770028}, {'photo_id': 1389272922, 'portfolio_id': 27770028}, {'photo_id': 1389272825, 'portfolio_id': 27770028}, {'photo_id': 1389272759, 'portfolio_id': 27770028}, {'photo_id': 1389272757, 'portfolio_id': 27770028}, {'photo_id': 1389272756, 'portfolio_id': 27770028}] map_portfolio_id_photo_id: {27770028: [1389275854, 1389275837, 1389275831, 1389275829, 1389275828, 1389275826, 1389275660, 1389275551, 1389275550, 1389275549, 1389275234, 1389275232, 1389275228, 1389275226, 1389275225, 1389275218, 1389275168, 1389275166, 1389275165, 1389275164, 1389274995, 1389274992, 1389274991, 1389274814, 1389274812, 1389274528, 1389274524, 1389274522, 1389274521, 1389274519, 1389274127, 1389274126, 1389274125, 1389274123, 1389274117, 1389273861, 1389273272, 1389273181, 1389273064, 1389273063, 1389273041, 1389273039, 1389273038, 1389273034, 1389273024, 1389273022, 1389273020, 1389273017, 1389273013, 1389273010, 1389272964, 1389272956, 1389272953, 1389272949, 1389272922, 1389272825, 1389272759, 1389272757, 1389272756]} ##### Call download_photos : nb_thread : 1 we have missing 0 photos in the step downloads : photo missing : [] try to delete the photos missing in DB ##### After download_photos ##### After load_data_input time to download the photos : 0.05507206916809082 #### fin chargement data Blocking on flush ? No conitnuing About to test input to load Calling datou_exec Inside datou_exec : verbose : True number of steps : 5 step1:ventilate_hashtags_in_portfolio Mon Oct 13 19:28:28 2025 VR 17-11-17 : now, only for linear exec dependencies tree, some output goes to fill the input of the next VR 22-3-18 : now we test the dependencies tree, but keep two separate code for datou_prepare_output_input until the code is correctly tested, clean and works in both case VR 22-3-18 : but we use the first code for the first step id = -1, build in the code of datou_exec VR 22-3-18 : we should manage here the case when we are at the first step instead of building this step before datou_exec After prepare type args : select max(UNIX_TIMESTAMP(created_at)) from MTRUser.mtr_portfolio_photos where mtr_portfolio_id in (27770028) Here we display some param of map_info ! map_filenames : {} map_photo_id_path_extension : {} map_subphoto_mainphoto : {} beginning of datou step ventilate_hashtags_in_portfolio : To implement ! To do loadFromThcl(), then load ParamDescType : thcl2725 get_desc_type_from_thcl : type of cat SELECT id, mtr_user_id, name, pb_hashtag_id, hashtag_id_list, button_legend_list, portfolio_id_lists, photo_hashtag_type, photo_desc_type, svm_limit, limit_tagging, is_public, live, created_at, updated_at, type_classification FROM MTRDatou.classification_theme WHERE `id` IN (2725) thcls : [{'id': 2725, 'mtr_user_id': 31, 'name': 'learn_qualipapia_rle_210302_2', 'pb_hashtag_id': 0, 'live': b'\x00', 'list_hashtags': 'Carton_brun,Carton_gris,Teint_Dans_La_Masse,autre_refus,cartonnette,environnement,kraft,metal,papier,plastique', 'svm_portfolios_learning': '3460440,3460441,3460446,3460434,3460439,3467416,3460442,3460443,3486028,3460445', 'photo_hashtag_type': 3410, 'photo_desc_type': 5186, 'type_classification': 'caffe', 'hashtag_id_list': '2107753024,2107753020,2107752385,2107752406,702398920,493012381,493202403,492628673,492668766,492725882'}] thcl {'id': 2725, 'mtr_user_id': 31, 'name': 'learn_qualipapia_rle_210302_2', 'pb_hashtag_id': 0, 'live': b'\x00', 'list_hashtags': 'Carton_brun,Carton_gris,Teint_Dans_La_Masse,autre_refus,cartonnette,environnement,kraft,metal,papier,plastique', 'svm_portfolios_learning': '3460440,3460441,3460446,3460434,3460439,3467416,3460442,3460443,3486028,3460445', 'photo_hashtag_type': 3410, 'photo_desc_type': 5186, 'type_classification': 'caffe', 'hashtag_id_list': '2107753024,2107753020,2107752385,2107752406,702398920,493012381,493202403,492628673,492668766,492725882'} Update svm_hashtag_type_desc : 5186 remove imagettes from duplicated photo Iterating over portfolio : 27770028 get user id for portfolio 27770028 get sub ptf for main ptf 27770028, type 3726 and hashtags ['cartonnette', 'metal', 'Carton_gris', 'papier', 'Carton_brun', 'environnement', 'mal_croppe', 'autre_refus', 'plastique', 'Teint_Dans_La_Masse', 'flou', 'kraft'] SELECT mptpi.id, mptpi.mtr_portfolio_id_1, mptpi.mtr_portfolio_id_2, mptpi.type, mptpi.hashtag_id, mptpi.min_score, mptpi.mtr_user_id, mptpi.created_at, mptpi.updated_at, mptpi.last_updated_at_desc, mptpi.last_updated_at_asc, h.hashtag FROM MTRPhoto.mtr_port_to_port_ids mptpi, MTRBack.hashtags h WHERE h.hashtag_id=mptpi.hashtag_id AND mptpi.`mtr_portfolio_id_1`=27770028 AND mptpi.`type`=3726 AND mptpi.`hashtag_id` in (select hashtag_id FROM MTRBack.hashtags where hashtag in ('cartonnette','metal','Carton_gris','papier','Carton_brun','environnement','mal_croppe','autre_refus','plastique','Teint_Dans_La_Masse','flou','kraft')) AND mptpi.`min_score`=0.5 SELECT mptpi.id, mptpi.mtr_portfolio_id_1, mptpi.mtr_portfolio_id_2, mptpi.type, mptpi.hashtag_id, mptpi.min_score, mptpi.mtr_user_id, mptpi.created_at, mptpi.updated_at, mptpi.last_updated_at_desc, mptpi.last_updated_at_asc, h.hashtag FROM MTRPhoto.mtr_port_to_port_ids mptpi, MTRBack.hashtags h WHERE h.hashtag_id=mptpi.hashtag_id AND mptpi.`mtr_portfolio_id_1`=27770028 AND mptpi.`type`=3726 AND mptpi.`hashtag_id` in (select hashtag_id FROM MTRBack.hashtags where hashtag in ('cartonnette','metal','Carton_gris','papier','Carton_brun','environnement','mal_croppe','autre_refus','plastique','Teint_Dans_La_Masse','flou','kraft')) AND mptpi.`min_score`=0.5 To do returned map {'metal': {'main_port_id': 27770028, 'sub_port_id': 27770039, 'hashtag': 'metal', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732769, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'autre_refus': {'main_port_id': 27770028, 'sub_port_id': 27770040, 'hashtag': 'autre_refus', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732770, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'papier': {'main_port_id': 27770028, 'sub_port_id': 27770041, 'hashtag': 'papier', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732771, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'kraft': {'main_port_id': 27770028, 'sub_port_id': 27770042, 'hashtag': 'kraft', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732772, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'flou': {'main_port_id': 27770028, 'sub_port_id': 27770043, 'hashtag': 'flou', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732773, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'cartonnette': {'main_port_id': 27770028, 'sub_port_id': 27770044, 'hashtag': 'cartonnette', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732774, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'mal_croppe': {'main_port_id': 27770028, 'sub_port_id': 27770045, 'hashtag': 'mal_croppe', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732775, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'Teint_Dans_La_Masse': {'main_port_id': 27770028, 'sub_port_id': 27770046, 'hashtag': 'Teint_Dans_La_Masse', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732776, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'plastique': {'main_port_id': 27770028, 'sub_port_id': 27770047, 'hashtag': 'plastique', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732777, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'environnement': {'main_port_id': 27770028, 'sub_port_id': 27770048, 'hashtag': 'environnement', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732778, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'Carton_gris': {'main_port_id': 27770028, 'sub_port_id': 27770049, 'hashtag': 'Carton_gris', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732779, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}, 'Carton_brun': {'main_port_id': 27770028, 'sub_port_id': 27770050, 'hashtag': 'Carton_brun', 'pht': 3726, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732780, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 33), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 18, 58)}} insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770039 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='metal' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770039) result : () SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275883,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770040 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='autre_refus' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770040) result : ((1389274423,), (1389275091,), (1389275237,), (1389275238,), (1389275239,), (1389275251,), (1389275252,), (1389275884,)) SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770041 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='papier' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770041) result : () SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770042 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='kraft' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770042) result : ((1389275246,), (1389275852,)) SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770043 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='flou' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770043) result : () SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770044 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='cartonnette' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770044) result : ((1389275052,), (1389275054,), (1389275056,), (1389275058,), (1389275060,), (1389275844,), (1389275845,), (1389275846,), (1389275892,), (1389275893,)) SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770045 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='mal_croppe' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770045) result : () SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770046 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='Teint_Dans_La_Masse' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770046) result : ((1389274420,), (1389274421,), (1389274422,), (1389274998,), (1389274999,), (1389275088,), (1389275089,), (1389275090,), (1389275235,), (1389275249,), (1389275250,), (1389275836,), (1389275878,), (1389275879,), (1389275880,), (1389275881,), (1389275882,)) SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770047 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='plastique' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770047) result : ((1389274436,), (1389274437,), (1389274438,), (1389275071,), (1389275245,), (1389275253,), (1389275895,), (1389275896,), (1389275897,), (1389275898,), (1389275899,)) SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770048 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='environnement' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770048) result : () SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770049 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='Carton_gris' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770049) result : ((1389274432,), (1389274433,), (1389275240,), (1389275241,), (1389275242,), (1389275838,), (1389275839,), (1389275886,), (1389275887,), (1389275888,), (1389275889,), (1389275890,)) SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") insert ignore into MTRUser.mtr_portfolio_photos (mtr_portfolio_id, mtr_photo_id, mtr_user_id,created_at) SELECT 27770050 , sub_photo_id, 979,now() FROM (SELECT csp.sub_photo_id, csp.crop_hashtag_id, csp.created_at FROM MTRPhoto.crop_sub_photo_ids csp, MTRPhoto.crop_hashtag_ids chi, MTRBack.hashtags h, MTRUser.mtr_portfolio_photos mpp WHERE mpp.mtr_portfolio_id=27770028 AND mpp.mtr_photo_id=chi.photo_id AND chi.id=csp.crop_hashtag_id AND chi.score>0.5 AND chi.type=3726 AND chi.hashtag_id=h.hashtag_id AND h.hashtag='Carton_brun' GROUP BY csp.crop_hashtag_id, csp.created_at order by csp.created_at desc) as a group by crop_hashtag_id; SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770050) result : ((1389274434,), (1389274435,), (1389275066,), (1389275092,), (1389275093,), (1389275243,), (1389275244,), (1389275847,)) SELECT mtr_photo_id FROM MTRUser.mtr_portfolio_photos WHERE mtr_portfolio_id IN (27770028) result : ((1389272756,), (1389272757,), (1389272759,), (1389272825,), (1389272922,), (1389272949,), (1389272953,), (1389272956,), (1389272964,), (1389273010,), (1389273013,), (1389273017,), (1389273020,), (1389273022,), (1389273024,), (1389273034,), (1389273038,), (1389273039,), (1389273041,), (1389273063,), (1389273064,), (1389273181,), (1389273272,), (1389273861,), (1389274117,), (1389274123,), (1389274125,), (1389274126,), (1389274127,), (1389274519,), (1389274521,), (1389274522,), (1389274524,), (1389274528,), (1389274812,), (1389274814,), (1389274991,), (1389274992,), (1389274995,), (1389275164,), (1389275165,), (1389275166,), (1389275168,), (1389275218,), (1389275225,), (1389275226,), (1389275228,), (1389275232,), (1389275234,), (1389275549,), (1389275550,), (1389275551,), (1389275660,), (1389275826,), (1389275828,), (1389275829,), (1389275831,), (1389275837,), (1389275854,), (1389275871,), (1389275883,), (1389275894,), (1389275901,)) select distinct(cspi.sub_photo_id) from MTRPhoto.crop_hashtag_ids chi, MTRPhoto.crop_sub_photo_ids cspi where chi.type=3726 and chi.photo_id in () and cspi.crop_hashtag_id = chi.id; Catched exception ! Connect or reconnect ! (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n and cspi.crop_hashtag_id = chi.id' at line 3") To do ! Use context local managing function ! SELECT mptpi.id, mptpi.mtr_portfolio_id_1, mptpi.mtr_portfolio_id_2, mptpi.type, mptpi.hashtag_id, mptpi.min_score, mptpi.mtr_user_id, mptpi.created_at, mptpi.updated_at, mptpi.last_updated_at_desc, mptpi.last_updated_at_asc, h.hashtag FROM MTRPhoto.mtr_port_to_port_ids mptpi, MTRBack.hashtags h WHERE h.hashtag_id=mptpi.hashtag_id AND mptpi.`mtr_portfolio_id_1`=27770028 AND mptpi.`type`=4417 AND mptpi.`hashtag_id` in (select hashtag_id FROM MTRBack.hashtags where hashtag in ('cartonnette','metal','Carton_gris','papier','Carton_brun','environnement','mal_croppe','autre_refus','plastique','Teint_Dans_La_Masse','flou','kraft')) AND mptpi.`min_score`=0.5 SELECT mptpi.id, mptpi.mtr_portfolio_id_1, mptpi.mtr_portfolio_id_2, mptpi.type, mptpi.hashtag_id, mptpi.min_score, mptpi.mtr_user_id, mptpi.created_at, mptpi.updated_at, mptpi.last_updated_at_desc, mptpi.last_updated_at_asc, h.hashtag FROM MTRPhoto.mtr_port_to_port_ids mptpi, MTRBack.hashtags h WHERE h.hashtag_id=mptpi.hashtag_id AND mptpi.`mtr_portfolio_id_1`=27770028 AND mptpi.`type`=4417 AND mptpi.`hashtag_id` in (select hashtag_id FROM MTRBack.hashtags where hashtag in ('cartonnette','metal','Carton_gris','papier','Carton_brun','environnement','mal_croppe','autre_refus','plastique','Teint_Dans_La_Masse','flou','kraft')) AND mptpi.`min_score`=0.5 To do returned map {'metal': {'main_port_id': 27770028, 'sub_port_id': 27770053, 'hashtag': 'metal', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732781, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'autre_refus': {'main_port_id': 27770028, 'sub_port_id': 27770054, 'hashtag': 'autre_refus', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732782, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'papier': {'main_port_id': 27770028, 'sub_port_id': 27770055, 'hashtag': 'papier', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732783, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'kraft': {'main_port_id': 27770028, 'sub_port_id': 27770056, 'hashtag': 'kraft', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732784, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'flou': {'main_port_id': 27770028, 'sub_port_id': 27770057, 'hashtag': 'flou', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732785, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'cartonnette': {'main_port_id': 27770028, 'sub_port_id': 27770058, 'hashtag': 'cartonnette', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732786, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'mal_croppe': {'main_port_id': 27770028, 'sub_port_id': 27770059, 'hashtag': 'mal_croppe', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732787, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'Teint_Dans_La_Masse': {'main_port_id': 27770028, 'sub_port_id': 27770060, 'hashtag': 'Teint_Dans_La_Masse', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732788, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'plastique': {'main_port_id': 27770028, 'sub_port_id': 27770061, 'hashtag': 'plastique', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732789, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'environnement': {'main_port_id': 27770028, 'sub_port_id': 27770062, 'hashtag': 'environnement', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732790, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'Carton_gris': {'main_port_id': 27770028, 'sub_port_id': 27770063, 'hashtag': 'Carton_gris', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732791, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 19, 4), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}, 'Carton_brun': {'main_port_id': 27770028, 'sub_port_id': 27770064, 'hashtag': 'Carton_brun', 'pht': 4417, 'min_score': 0.5, 'mtr_user_id': 979, 'id': 18732792, 'last_updated_at': datetime.datetime(2025, 10, 13, 19, 26, 34), 'last_updated_at_desc': datetime.datetime(2025, 10, 13, 19, 26, 34), 'last_updated_at_asc': datetime.datetime(2025, 10, 13, 19, 19, 4)}} insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770053,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770039 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770054,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770040 Catched exception ! (1213, 'Deadlock found when trying to get lock; try restarting transaction') Connect or reconnect ! insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770055,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770041 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770056,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770042 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770057,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770043 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770058,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770044 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770059,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770045 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770060,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770046 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770061,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770047 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770062,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770048 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770063,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770049 insert ignore into MTRUser.mtr_portfolio_photos(mtr_portfolio_id,mtr_photo_id,mtr_user_id) select 27770064,mtr_photo_id,mtr_user_id from MTRUser.mtr_portfolio_photos where mtr_portfolio_id = 27770050 Catched exception ! (1213, 'Deadlock found when trying to get lock; try restarting transaction') Connect or reconnect ! ERROR in datou_step_exec, will save and exit ! (1213, 'Deadlock found when trying to get lock; try restarting transaction') File "/home/admin/workarea/git/Velours/python/mtr/datou/datou_lib.py", line 2339, in datou_exec output = datou_step_exec(sNext, args, cache, context, map_info, verbose, mtr_user_id) File "/home/admin/workarea/git/Velours/python/mtr/datou/datou_lib.py", line 2641, in datou_step_exec return post_process.datou_step_exec_ventilate_hashtags_in_portfolio(param, json_param, args, context, map_info, File "/home/admin/workarea/git/Velours/python/mtr/datou/lib_step_exec/lib_step_post_processing.py", line 281, in datou_step_exec_ventilate_hashtags_in_portfolio context.pq.copy_portfolio(old_port_id,sub_port_id , verbose = verbose) File "/home/admin/workarea/git/Velours/python/mtr/database_queries/portfolio_queries.py", line 538, in copy_portfolio self.gq.insert(query) File "/home/admin/workarea/git/Velours/python/mtr/database_queries/general_queries.py", line 151, in insert number = cursor.execute(query, args) File "/home/admin/.local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 179, in execute res = self._query(mogrified_query) File "/home/admin/.local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 330, in _query db.query(q) File "/home/admin/.local/lib/python3.8/site-packages/MySQLdb/connections.py", line 280, in query _mysql.connection.query(self, query) [1389275854, 1389275837, 1389275831, 1389275829, 1389275828, 1389275826, 1389275660, 1389275551, 1389275550, 1389275549] map_info['map_portfolio_photo'] : {27770028: [1389275854, 1389275837, 1389275831, 1389275829, 1389275828, 1389275826, 1389275660, 1389275551, 1389275550, 1389275549, 1389275234, 1389275232, 1389275228, 1389275226, 1389275225, 1389275218, 1389275168, 1389275166, 1389275165, 1389275164, 1389274995, 1389274992, 1389274991, 1389274814, 1389274812, 1389274528, 1389274524, 1389274522, 1389274521, 1389274519, 1389274127, 1389274126, 1389274125, 1389274123, 1389274117, 1389273861, 1389273272, 1389273181, 1389273064, 1389273063, 1389273041, 1389273039, 1389273038, 1389273034, 1389273024, 1389273022, 1389273020, 1389273017, 1389273013, 1389273010, 1389272964, 1389272956, 1389272953, 1389272949, 1389272922, 1389272825, 1389272759, 1389272757, 1389272756]} final : True mtd_id 4302 list_pids : [1389275854, 1389275837, 1389275831, 1389275829, 1389275828, 1389275826, 1389275660, 1389275551, 1389275550, 1389275549] begin to insert list_values into mtr_datou_result : length of list_values in save_final : 10 insert ignore into MTRPhoto.mtr_datou_result (mtd_id, mtr_portfolio_id,mtr_photo_id,result,result_long,result_double,hashtag_id,proba, mtr_current_id) values (%s,%s,%s,%s,%s,%s,%s,%s,%s) on duplicate key update mtr_portfolio_id = mtr_portfolio_id list_values : [('4302', '27770028', '1389275854', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275837', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275831', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275829', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275828', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275826', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275660', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275551', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275550', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031'), ('4302', '27770028', '1389275549', '[>, , , , "(1213, \'Deadlock found when trying to get lock; try restarting transaction\')"]', '-1', '-1.0', '501120777', '1.0', '3935031')] time used for this insertion : 0.04030776023864746 save_final ERROR in last step ventilate_hashtags_in_portfolio, (1213, 'Deadlock found when trying to get lock; try restarting transaction') time spend for datou_step_exec : 8.582565307617188 time spend to save output : 0.049834251403808594 total time spend for step 0 : 8.632399559020996 need to delete datou_research and reload, so keep current state 1 caffe_path_current : About to save ! 2 After save, about to update current ! 1.18user 0.79system 0:12.46elapsed 15%CPU (0avgtext+0avgdata 99368maxresident)k 720inputs+136outputs (0major+48483minor)pagefaults 0swaps