need help with my program

posted in Off Topic
View:
Threaded
Linear
Threaded
#1
Foxym
0
Frags
+
–

regarding the program used for this: https://www.vlr.gg/651575/vct-teams-lifetime-data-part-2

im trying to add multiprocessing to it
but i cant figure it out for the life of me
https://i.ibb.co/nshjSfR4/image-1778892995944.png

errors im getting

RuntimeError
ConnectionResetError: [Errno 104] Connection reset by peer

im considering sticking with the "just sleep through it" method

#2
NotaSenFan27
2
Frags
+
–

claude ai

#3
Foxym
1
Frags
+
–

fuck off

#4
NotaSenFan27
0
Frags
+
–

not all ai is bad ai

#5
delighted
0
Frags
+
–

use threading first, add retries with backoff

and lower the concurrency

#6
Foxym
0
Frags
+
–

did try using them, did not figure out how to run multiple threads at once
(prolly cause i didnt use the "args" thingy and just put it directly into it
like this:

threading.Threads(target=Calculate_Event_Stats(VCT_TEAMS[x], aom=0)

)

edit:
what is concurrency
it is currently 3am for me so im a bit slow rn

#7
delighted
0
Frags
+
–

isn't concurrency multiple tasks making progress during overlapping times

#10
verybluepond
-1
Frags
+
–

concurrency jumpscare

I'm probably talking to a bot but the `multiprocessing` module is used to bypass the GIL for "truly parallel code" so if speed is what he's looking for this is better, although the % gains would probably have to be measured, I don't think it's all that faster for this block of code

#11
delighted
0
Frags
+
–

the GIL only matters for CPU heavy work iinw

#12
verybluepond
-1
Frags
+
–

this is pretty literally trying to get more juice out of the CPU, prompt your shit correctly brother

#20
CrackedDuelist
-1
Frags
+
–

you have encountered the #1 larper on this site

#45
ari
0
Frags
+
–

I'm crying bro he has no idea what he's talking about

#39
zappp
0
Frags
+
–

who is down voting my guy

#8
31Raven
0
Frags
+
–

did u try turning it off and on again

#9
verybluepond
0
Frags
+
–

you should probably test if calculate_vct_stats() actually hits vlr before trying to parallelize tbh

also your inner loop looks like it's stepping through just test[0] and test[1] for the length of your test array.
Write a straightforward module with a single data point and process first and verify it runs before trying to do tricks.

#14
Foxym
0
Frags
+
–

if you mean "gets info from vlr"
yeah it does

if i dont do multiprocessing but use the old way i compiled the data i get no issues
but its slow because it goes through each team 1 by 1
https://i.ibb.co/mCM7zfQ7/image-1778929657881.png

but hey it works

as for a single Multiprocessing process, im still getting the same errors

RuntimeError
ConnectionResetError: [Errno 104] Connection reset by peer
#16
verybluepond
0
Frags
+
–

write like so:

p = multiprocessing.Process(target=your_callable, args=(VCT_TEAMS[0],))

p.start()
p.join() 

what does it show then? the formatting might be bad cause I typed out on mobile, but legible enough

#17
Foxym
0
Frags
+
–

same errors, maybe a screenshot would explain more

https://i.ibb.co/9HMFFdgL/image-1778931887588.png

https://i.ibb.co/3y0mZ1V1/image-1778931957993.png

#18
verybluepond
0
Frags
+
–

oh run it with the proper entry point then
` if name = 'main' :

you have to specify the entry point to the script explicitly to avoid spawning new processes before the current process is fully init

add: If this actually runs, I would point you to the multiprocessing.Pool() functionality for pythonic parallelization

#19
Foxym
0
Frags
+
–

im now getting this error
https://i.ibb.co/m5VghR1R/image-1778933534193.png

#21
verybluepond
0
Frags
+
–

I believe you see some output at the top (running the whole program took x secs) from your script so it looks like it's running? progress

after your p.start() add a p.join() or your time.sleep(20) to pause execution until your child process is done, allow for resource cleanup basically

#22
Foxym
0
Frags
+
–

my issue is the index error
something about openpyxl
https://i.ibb.co/9kmWNb1p/image-1778934188707.png
i think this is the issue
no idea how i will get this panda output
https://i.ibb.co/67fqN3MW/image-1778934273311.png
into like a functioning thing for the excel spreadsheet writing

#23
verybluepond
0
Frags
+
–

what format does the scraper return the data in? JSON? verify format first, the read into pandas, then call to_csv() afterwards. You don't really need to serialise into .xlsx, that's not very popular, excel reads csvs either way

#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

#13
BabyWizard
0
Frags
+
–

This is too confusing im scared

#15
Foxym
0
Frags
+
–

understandable

#27
NekoSugarGirls17
0
Frags
+
–

you need more RAM

#28
Foxym
0
Frags
+
–

then give me the money for that
im broke

#31
NekoSugarGirls17
0
Frags
+
–

you can download ram for free bro

#32
Foxym
0
Frags
+
–

swap space
and no, you cant download that
you need to set it up through the terminal (in linux atleast)

#41
OmenEnthusiast
-1
Frags
+
–

nah just try this: https://downloadmoreram.com/ it works, trust

#40
tubelight
0
Frags
+
–

You will need to win a lottery for this (ram)

  • 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