создание распределенного приложения python для сканирования. он состоит из главного сервера и связанных клиентских приложений, которые будут запускаться на клиентских серверах. цель клиентского приложения - запустить целевой сайт, чтобы извлечь определенные данные. клиенты должны идти «глубоко» внутри сайта, за несколькими уровнями форм, поэтому каждый клиент специально ориентирован на данный сайт.архитектура python question
каждый клиент приложение выглядит как-то
main:
parse initial url
call function level1 (data1)
function level1 (data)
parse the url, for data1
use the required xpath to get the dom elements
call the next function
call level2 (data)
function level2 (data2)
parse the url, for data2
use the required xpath to get the dom elements
call the next function
call level3
function level3 (dat3)
parse the url, for data3
use the required xpath to get the dom elements
call the next function
call level4
function level4 (data)
parse the url, for data4
use the required xpath to get the dom elements
at the final function..
--all the data output, and eventually returned to the server
--at this point the data has elements from each function...
мой вопрос: учитывая, что количество вызовов, производится в функции ребенка от текущей функции изменяется, я пытаюсь понять вне лучший подход.
each function essentialy fetches a page of content, and then parses
the page using a number of different XPath expressions, combined
with different regex expressions depending on the site/page.
if i run a client on a single box, as a sequential process, it'll
take awhile, but the load on the box is rather small. i've thought
of attempting to implement the child functions as threads from the
current function, but that could be a nightmare, as well as quickly
bring the "box" to its knees!
i've thought of breaking the app up in a manner that would allow
the master to essentially pass packets to the client boxes, in a
way to allow each client/function to be run directly from the
master. this process requires a bit of rewrite, but it has a number
of advantages. a bunch of redundancy, and speed. it would detect if
a section of the process was crashing and restart from that point.
but not sure if it would be any faster...
я пишу синтаксический анализ сценариев в питона ..
так ... любые мысли/комментарии будут оценены ...
я могу получить в гораздо более подробно, но не хотел никого ронять!
спасибо!
Том
Возможно, вы захотите удалить «код-отступ» из последней половины своего вопроса, так как его код не является. – viksit
Также, пожалуйста, используйте буквы верхнего порядка, особенно для личного местоимения (I). Если ваш вопрос легко читать, вы получите хорошие ответы. Если ваш вопрос трудно читать (т. Е. В нижнем регистре 'i'), люди перестанут пытаться его разобрать и двигаться дальше. –
Серьезно, зачем это удалять? Действительный вопрос, действительные ответы. Как насчет выбора ответа, который помог вам больше всего? – Will