
Show HN: IPpy – Parallel testing of IP addresses and domains in python - marlynm
https://github.com/shivammathur/IPpy?show=true&ref=yc
======
storyinmemo
My suggestion for learning: re-write this using futures. Here's a quick
example of using similar parallelism to search structured json in gzip'd
files:
[https://github.com/autocracy/snippets/blob/master/search_clo...](https://github.com/autocracy/snippets/blob/master/search_cloudtrail.py)

~~~
emj
Basically xargs in python, and I love xargs.

There are some cool examples of places were xargs fails in the docs, this got
me very excited I hope it works in 2.7.
[https://docs.python.org/3/library/concurrent.futures.html](https://docs.python.org/3/library/concurrent.futures.html)

~~~
d0mine
There is futures module for Python 2.7 on PyPI.

In simple cases, you could use multiprocessing.Pool():

    
    
      results = pool.map(processfile, getpaths())
    

There is also ThreadPool. There are known issues with multiprocessing
especially on Python 2.7 e.g., Ctrl+C handling.

Though you don't need threading to manage concurrent subprocesses or IO
(Gevent, Twisted or curio if you use Python 3).

------
inkvizitor
Did something similar few years ago natively in Python using Gevent. I think
that it could scan several hundreds of IP's per second.

[https://github.com/inkvizitor/asyncping](https://github.com/inkvizitor/asyncping)

------
jhoechtl
Where Python warrants a HN post, Golang (Rust, others) calls it natural. Use
the right "tool" to do the job?

------
res0nat0r
checkout fping: [https://fping.org/](https://fping.org/)

------
formula_ninguna
what's the use case of it?

~~~
purrcat259
I would guess: checking if machines are online without rolling an overkill
monitoring solution. More of a smoke test than a proper solution (ping does
not ensure a service is up for example).

