need help with my program

posted in Off Topic
View:
Threaded
Linear
Threaded
← View full thread
#24
Foxym
0
Frags
+
–

the scraped format should be Html
https://i.ibb.co/6Rp4HVW0/image-1778935199809.png

as for the error, its reporting that no sheet available
my assumption is that while the subprocess compiles data, the main program just passes through and runs the next lines as normal

#25
verybluepond
0
Frags
+
–

if it's written correctly, it shouldn't create the sheet until our sub process completes.

my eyes are lowkey hurting, so lemme see if I can spell out the correct flow.

we run scraper in parallel, then retrieve a result object, then we extract the text content from the result object and serialise using pandas or some other library and save. That's it.

you don't need to write to the sheet before u've gotten the entire result object, that seems to lead to some kind of race condition during writes as u're seeing. U have a thousand lines (scary, there shouldn't be so much code?) so there are a lot of moving parts I'm not seeing, but if u follow this sequence step by step u should be fine.

For the multiprocessing, isolate that part of your code and test it runs. Then use Pool() properly.

#26
Foxym
0
Frags
+
–

i set up a pastebin for you to check
might help
just as a slight warning, this is terrible to read
most of the stuff that prolly give the error are closer to the end
https://pastebin.com/YareLXiX

#29
verybluepond
0
Frags
+
–

alright I'll take a look when I'm not afk. If I get it to work I'll paste back here.

#30
Foxym
0
Frags
+
–

thank you
if you want you can sign off your work

#33
verybluepond
0
Frags
+
–

gimme your previous stats without parallel exec

Seems it's just a couple of lines (I'm not refactoring anything, just adding)

#35
Foxym
0
Frags
+
–

a full compilation of all VCT teams took 6 hours last time (all 48 teams)

#36
verybluepond
0
Frags
+
–

see below, run it now

#34
verybluepond
0
Frags
+
–

alr I gotta bounce king. Code below (didn't touch anything except the multiprocessing part). when ur done actually fix ur variable names, hard to navigate.

included some helpful comments
https://pastebin.com/axTfnTum
script takes an avg of ~ 450 seconds to fully compile now (5 run experiment,, idk if that's better or not. 👍

add: https://ibb.co/LbKMfWg

#37
Foxym
0
Frags
+
–

thanks mate
though, how can i add more arguments

#38
verybluepond
0
Frags
+
–

just modify state in your function to account for extra arguments. map() takes only f and iterable, either work with that or swap out for map_async with a callback chain. Real modular codebases use multiprocessing in tandem with context managers and stuff for proper management, but this is just a script. No point, I don't think. You can refactor in future if u want though.

Overall rtfm, it's a good read -> https://docs.python.org/3/library/multiprocessing.html

#42
Foxym
0
Frags
+
–

do you know how i can restore data sorting and the excel writing functionallity so i dont lose the data points in the terminal and dont spend hours organizing the data myself?

#43
verybluepond
0
Frags
+
–

did I delete that? I don't think so.

read your created txt files into pandas and manipulate as u wish, or do it at some other place in your Team_File creation process.

  • Preview
  • Edit
› check that that your post follows the forum rules and guidelines or get formatting help
Sign up or log in to post a comment