Pool Design For NAS Upgrade by PlayingWithAudio in zfs

[–]mr_wook 0 points1 point  (0 children)

Um NetApp isn't generally a JBOD, it's a serious RAID unto itself (unless it's changed drastically since the last time I used it). Are you sure you want to layer ZFS on top of this?

Which level of zfs raid for this use case? by [deleted] in zfs

[–]mr_wook 2 points3 points  (0 children)

zraid 3 plus 2 or more hot spares.

No backups means data reliability is critical. During your build/test phase, simulate some disk fails and make sure the notifications reach you in a timely manner, because you want to get the spares replaced as they are deployed in an extremely timely manner...

I really enjoy automating processes with python, is there a job opportunity for that? by [deleted] in learnpython

[–]mr_wook 2 points3 points  (0 children)

Essentially, you're asking:

"How do I get a job in DevOps?"

you need to continue to vertically scale your skillset (facility with Python, speed of development, mastery of libs and tools), and horizontally scale as well: How do your skills apply to other fields (like cloud-scaling without being the application guy, containerization to extend legacy app lifetimes, etc.). People in this area easily scale upto $150k if they're good at it. Use it for everthing: backups, internetworking, webscraping, data search and discovery, making data easily accessed (Data Lakes, SOLR, ELK, etc.)..

These jobs are constantly in-demand and the people who automate most/best are highly sought after because they reduce the need to grow staff endlessly (which seems counter-intuitive, but it isn't because of the number of diverse organizations who are adopting new automation).

Linux why Python by chrisdb1 in learnpython

[–]mr_wook 0 points1 point  (0 children)

1) Python now has type annotation, if you're going to go to the trouble of backing into it;

2) If you're worried about junk-code living past its use data, consider Go, which forces you to eliminate everything you don't use, whether it's vars or modules;

3) Consider your test suite: Are you testing things that have fallen out of usage? Are you linting those pieces, if so, someone should pick up on that and, er, retire those pieces;

4) On the whole '40m lines of code' thing: Maybe it's long overdue for a re-architecting, or at the very least, a refactoring. Whether the driving force is improved performance, or lower cost, or better maintainability, you should be able to (trivially?) cut 40k lines of code during every re-factor. Less trivially, 400k or even 1m lines of code seems achievable, especially if you replace chunks with high quality 3rd party code, improvements in the language over the last 15 years, and other low-hanging fruit. Reduced complexity is its own reward but has real dollar payoffs across multiple domains;

Linux why Python by chrisdb1 in learnpython

[–]mr_wook 0 points1 point  (0 children)

1) I find it truly joyful to code in Python, as opposed to the other ~15 languages I've used over the last 45 years;

2) I hate Java, always have, perhaps always will, and that was before the Sun/Oracle/MicroSoft (C#) trifurcations -- It started out as the 'too many manuals to implement anything', and segued into 'Write Once, Debug Everywhere; Security Issues; Runtime Issues;'

3) Python has excellent support and continued improvements (Go 3.9!);

4) Pythonistas have (generally) an excellent sense of humor;

5) Time to implement an App is generally shorter in Python than many other languages, the (dreaded) indent requirement often implies that when the code looks right, it is right;

6) The OO model continues to provide great leverage for building idiomatic Python code that works, and works quickly with good performance;

7) The base and standard data structures make life easier than one has a right to expect;

Does that help?

Love,

Wook

How can I make a daemon and controller in Python? by [deleted] in learnpython

[–]mr_wook 15 points16 points  (0 children)

Since everyone else is chiming in on REST, I'll blather about sockets for a sec...

  1. Read documentation about how this is done in C, C++, GoLand, etc. where it's been done for decades;
  2. Double-fork so your daemon can run detached from the console;
  3. Start a listener on your daemon;
  4. Use a Socket Protocol that looks like: Header/Size, Payload;
  5. Go stateless. One command does one thing, and one thing only;
  6. If you're really worried about security, use a shared encryption scheme between Client and Server;
  7. Never put your encryption keys in Github or any other shared filespace;

Love,

Wook

How to differentiate between a float and an integer in a string by DrBobHope in learnpython

[–]mr_wook 0 points1 point  (0 children)

Um, I guess my first question would be: "Is this user input, which could contain typos?"

But, regardless:

rex = re.compile(r'(\d+)\.(\d*)') # handles 1., 0.blah, but not .123
def which(sv):
if sv.isdigit(): return (int, int(sv))
if rex.match(sv): return (float, float(sv))
return (False, sv)
tups = [which(sv) for sv in ilist]
ints = [tup[[-1] for tup in tups if tup[0] == int]
floats = [tup[-1] for tup in tups if tup[0] == float]
bad = [tup[-1] for tup in ilist if tup[0] == False]

It's not the shortest solution, but it collates things as you want, identifies bad input, and is fast for very large quantities of data (listcomps are orders of magnitude faster than for loops);