|
Attach a debugger and see what the worker thread is actually doing.
|
# ? Aug 18, 2023 05:44 |
|
|
# ? May 30, 2024 12:19 |
|
Do any of the tasks themselves submit to the ThreadPoolExecutor, or are they waiting on the results of another task? Either of those could cause a deadlock.
|
# ? Aug 18, 2023 06:41 |
|
Hah, it was a Process being created by each thread that wasn't getting closed properly! PSA if you use multiprocessing clean up your poo poo!!!
|
# ? Aug 19, 2023 02:16 |
|
Just ranting here, but ugh. I'm working on a very classic 'too many cooks, not enough definition or planning' problem. I've raised this concern already but we're both past the majority of the code being written, as well as in a state where we're now in the death march zone of 'whoops you hosed up and it's too late to fix it'. I'm going to do what I can to address this moving forward, but for now...ugh. We have a demo next week to important people, so we're in that 'oh gently caress what needs to be fixed' phase. I took on a task to clean up an issue where some state machine implementations are not properly implementing certain behaviors. This failure is because we never defined what these goddamn behaviors should be in the first place, so I'm not surprised people did it wrong, but basically stuff that should be done in state A is done in state B instead. No big deal, I said - I've got a very good handle on the codebase and the state machine at this point so I'll just pop in and move things around. Ah, gently caress. This is like an onion of terrible bullshit. Here's how it's been going:
I've found some just...very strange code that I don't know how made it through code review. Here's one such sample: Python code:
Edit: Why stop ranting, while I'm at it. So another fun problem I've been slowly cleaning up is that we have a bunch of instances where people were setting up their entire test cases one at a time. For example: Python code:
Falcon2001 fucked around with this message at 03:33 on Aug 26, 2023 |
# ? Aug 26, 2023 03:27 |
|
You need a technical lead OP. Someone who looks at this:Falcon2001 posted:
and just says "no, do something else, or do something else"
|
# ? Aug 26, 2023 04:17 |
|
What really gets my goat is when a contractor or subcontractor gets other members of their team to approve some bullshit code and things just slide in without an expert getting eyes on it. The people who deal with the contracts aren't willing to put the hammer down so long as the letter of the contract is being followed, and if we ask for a contract to have provisions for things like code quality that isn't the blandest form of "this scanning tool say the code isn't completely garbage, a D is still a passing grade!" we get pushback because that may cost more. Motherfucker, there is no point in even having a contractor if we wind up having to throw away everything that they deliver. The contractor team I'm working with right now isn't like that thankfully, but I've had to put up with some real bullshit that I'd rather not repeat. It's hard to find good help
|
# ? Aug 26, 2023 04:25 |
|
QuarkJets posted:You need a technical lead OP. Someone who looks at this: We have a lead but he's a career java dev and *way* overworked so he can't spend the time with folks to properly review things.
|
# ? Aug 26, 2023 05:27 |
|
Falcon2001 posted:We have a lead but he's a career java dev and *way* overworked so he can't spend the time with folks to properly review things. If your lead is always busy doing other stuff then you don't really have a lead, you have a part-time subject matter expert
|
# ? Aug 26, 2023 07:56 |
|
I'm not in a position where I'm coding day and night anymore. Somehow I'm working with the three technologies I hate the most - salesforce, informatica, and oracle. But it's low stress so I don't mind. Anyways, it's nice to be able to use python to "automate the boring stuff", as the saying goes. Like for example, the senior data analyst had to compare one spreadsheet with object fields from salesforce and one spreadsheet with fields that were approved by the higher-ups, the goal being to match the approved fields against the raw output. She was manually eyeballing everything and to just get 75% of the Account object took her like three weeks. So she handed the task to me and the next day asked about my progress. I told her I was done and she said, "what? you finished Account already?" "no, I finished all the top 10 objects" "what?? howww?!?" "I wrote a python script to do it for me " It was an extremely simple script, but still rewarding.
|
# ? Aug 26, 2023 23:56 |
|
Seventh Arrow posted:I'm not in a position where I'm coding day and night anymore. Somehow I'm working with the three technologies I hate the most - salesforce, informatica, and oracle. But it's low stress so I don't mind. Anyways, it's nice to be able to use python to "automate the boring stuff", as the saying goes. It's hilarious how big the gap exists in some places when it comes to 'easily programmable problems'. A friend of mine is an accountant at a major company and the majority of their workflows are at best running on various excel worksheets people have put together, and as the only person even remotely interested in technology he's basically de-facto in charge of a huge new initiative.
|
# ? Aug 27, 2023 19:52 |
|
Falcon2001 posted:It's hilarious how big the gap exists in some places when it comes to 'easily programmable problems'. A friend of mine is an accountant at a major company and the majority of their workflows are at best running on various excel worksheets people have put together, and as the only person even remotely interested in technology he's basically de-facto in charge of a huge new initiative. This is the epitome of a double-edged sword. I negotiated for (and did not get, for unforeseeable reasons unrelated to anything I was doing) a 13k raise my first time hitting this scenario, but it cost me quite a bit of sanity along the way.
|
# ? Aug 28, 2023 21:49 |
|
Being haunted by a Python trivia question. Can anyone think of a good way to write a generator expression (single line, stdlib only) that infinitely provides the previous output compounded with some other value? Reaching out to itertools.accumulate was all I could think of, but I'm wondering if there's something I just haven't ever come across that let's you cache previous value within a generator expression.code:
The March Hare fucked around with this message at 04:05 on Aug 31, 2023 |
# ? Aug 31, 2023 03:56 |
|
"I want to use just the python standard library but not the standard library function that literally implements exactly the thing I'm trying to do" seems like a very strange constraint.
|
# ? Aug 31, 2023 13:06 |
|
Jabor posted:"I want to use just the python standard library but not the standard library function that literally implements exactly the thing I'm trying to do" seems like a very strange constraint. I mean it's self imposed in this instance because it seems a little strange to me to give this trivia question expecting someone to know about it. Totally possible this was the intended answer, it's just not sitting right with me.
|
# ? Aug 31, 2023 13:34 |
|
Essentially what you're doing is a reduction (functools.reduce), but you want to have a generator that outputs every intermediate result instead of just the final one. That's basically the purpose of accumulate - but even if you didn't know about it exactly, it seems reasonable to suppose that a stdlib function to do that would exist? Would it feel better if you were using the arguments to explicitly specify the initial value and a combining function instead of just using the defaults?
|
# ? Aug 31, 2023 16:47 |
|
I don't feel good for having conceived this:Python code:
|
# ? Aug 31, 2023 16:49 |
|
Jabor posted:Essentially what you're doing is a reduction (functools.reduce), but you want to have a generator that outputs every intermediate result instead of just the final one. That's basically the purpose of accumulate - but even if you didn't know about it exactly, it seems reasonable to suppose that a stdlib function to do that would exist? Yeah, in the actual solve I was both supplying a lambda to the func arg (since it wasn't actually a simple addition) and an initial value due to some additional complexity in the prompt, but I didn't provide those in my example since I was mostly curious about the essence of the question: is there some other way to store state within a generator that I'm not aware of? The thing that isn't sitting well with me is specifically that a company would use this as a screening question (particularly since the job listing mentioned they were open to candidates with no real regard for particular language experience). Though I guess if what you are looking for in a candidate is: "they are familiar w/ itertools" then it makes sense. Yeah, I hadn't even considered our old friend the walrus. I'd rather use accumulate for this ridiculous trivia question, but good to know you can do that - I guess, lol. The March Hare fucked around with this message at 17:47 on Aug 31, 2023 |
# ? Aug 31, 2023 16:56 |
|
I'm getting a little lost here in the "meta" of developing an internal utility app which is essentially just a wrapper of a few existing packages and some existing 3rd party APIs, along with some customs extensions I write using the built in extensions functions for one of these packages. Goal of the app is to basically take some existing business-specific workflows that currently only I do in Python on an ad-hoc basis, and turn it into an app. These workflows are very domain specific and they each currently require knowledge about a bunch of org policy, legal stuff etc. to do, but I'm the only one who knows how to do it. Luckily for my managers, im a data analyst who's also been messing around with python and thought hey, why not learn some dev skills and upskill a bit from just being an adhoc script monkey so that my colleagues who might be forced to do the same work don't have to read and materialize poorly documented esoteric business logic and policy that should've been developed into an app years ago. I could see this app being extended or used down the road by more experienced developers as part of some ETL pipelines or a microservice. But this isn't certain. So my thinking here was that I wanted to keep this mostly in Python and not deal with webservers and HTTP and all that because the current usecase is just for other analysts comfortable in jupyter notebooks to be able to import this as a python package into their workspace to write reports. After a lot of analysis paralysis I've narrowed down to making this in a "modulith" style because while my initial usecase is just as a python package, I could see myself extending this into a streamlit, plotly dash or flask app to learn a little GUI stuff. As I understand it, moduliths have you separating your code into separate components but with each of them containing the application, domain/business logic with internal APIs to talk to eachother. Would something like this be an okay use of a modulith pattern? It's basically my internal compromise between "gently caress it, this is a tool for me and my team and I dont need to gently caress with web frameworks for a working MVP" and "but I'm trying to learn best practices, and that if it works well it could very likely be extended by some real devs who would be stuck with my spaghetti bullshit." Part of the reason "I care" is because in our codebase I can see that other analysts also tackled these exact same requirements but they never took the time into making it into an actual application, instead it's just a bunch of notebooks and example tutorials. So while I read through them because I'm a nerd, most of my other colleagues aren't interested in python or dev so they want to just focus on the business workflow parts they're being9 asked to do. Up until now new folks always come to me for help, but so much of my "knowledge" is esoteric recreated archeology from past docs of people who did this but never bothered to actually coherently design these workflows into something easily repeatable. I know others are frustrated too because I'm pretty much the only one who knows this stuff and so when they turn to me I don't really have much to show for it. FYI, I know I'm overthinking this. This post is more of a way to organize my planning and thoughts, so please ignore if it's word salad. Oysters Autobio fucked around with this message at 18:48 on Aug 31, 2023 |
# ? Aug 31, 2023 18:41 |
|
small world, I'm also a data analyst that got irritated enough at repetitive work to start writing code. I can only recommend that you embrace the fact that, if you have to return to the code 1+ months after writing it, you are gonna want to hit your past self with a chair. I don't know what I'm doing well enough to give you much more advice than that, but I can vouch for trying to anticipate future work Worst-case-scenario so far has been spending unnecessary effort that I learned a lot from spending. ComradePyro fucked around with this message at 19:36 on Aug 31, 2023 |
# ? Aug 31, 2023 19:28 |
|
Oysters Autobio posted:I'm getting a little lost here in the "meta" of developing an internal utility app which is essentially just a wrapper of a few existing packages and some existing 3rd party APIs, along with some customs extensions I write using the built in extensions functions for one of these packages. So a couple notes: If you're starting off building just a library for import, then the idea of a monolith/modulith/whatever is basically not that important, so don't overthink it. It is equally frustrating to split stuff out to far as it is to have things in a gigantic single file, but for different reasons - so don't start by trying to figure out a million different modules/etc. The biggest pattern to be aware of if you're planning on moving this to a web service later is to separate things like 'display' from 'logic'; for now you can just have different code setups handle different actions. The major thing would be to separate out things like print statements from what generates the data. This way when you decide to move things around later you've already done the single biggest split you need to do. Another note - consider what happens if you spend a bunch of time overthinking this, make some highly architected setup, and then...you don't finish the project. All that time and effort didn't produce any output. It's more important to do something useful, especially if you're doing it for work, than it is to do something necessarily perfect. There's a lot of wrong ways to write code, but there's no right way. What happens if you do it wrong? You rewrite it later. Software that's good enough to be useful must eventually be rewritten or updated, so ensure that the code you write can be understood. This means things like using type hints, writing docstrings, and learning how to leave good comments. Tip on comments: don't comment what something does. Comment why something does what it does. Python code:
Finally: building a purpose built app that does something specifically is very useful, but you should recognize that there's plenty of reasons to have exploratory scripts/etc as well; the app is going to force you to cover a ton of edge cases that you might be able to skim over. ComradePyro posted:small world, I'm also a data analyst that got irritated enough at repetitive work to start writing code. I can only recommend that you embrace the fact that, if you have to return to the code 1+ months after writing it, you are gonna want to hit your past self with a chair. I don't know what I'm doing well enough to give you much more advice than that, but I can vouch for trying to anticipate future work Good news everyone! This never goes away...or at least not until you get better at docstrings/type hints/comments. But also treasure these moments because they're one of the best ways to learn.
|
# ? Sep 1, 2023 03:00 |
|
Use typehints and good variable names and function names. Write simple functions. Write unit tests and then use them routinely.
|
# ? Sep 1, 2023 03:24 |
|
Just today, I put in the most basic rear end updates into some code I wrote like a year ago. The file already had the most basic testing possible in it, and I saw it and said "sure, I guess I'll check my work" and found like 3 errors. Because I wrote those tests a year ago, I was able to finish half a bottle of wine before my long weekend started. So proud of who I was, that man is my hero
|
# ? Sep 1, 2023 04:10 |
|
StumblyWumbly posted:Just today, I put in the most basic rear end updates into some code I wrote like a year ago. The file already had the most basic testing possible in it, and I saw it and said "sure, I guess I'll check my work" and found like 3 errors. At what point in the coding journey do you transition from "there no coder worse than me, 6 months ago" to "old me was my hero"
|
# ? Sep 1, 2023 04:18 |
|
CarForumPoster posted:At what point in the coding journey do you transition from "there no coder worse than me, 6 months ago" to "old me was my hero" This implies a one way path when in reality Previous Me is the best and worst of all possible futures; a superstate composed upon itself and containing all dread and terror and wonder at once. But mostly, he's just a jerk.
|
# ? Sep 1, 2023 04:53 |
|
Falcon2001 posted:This implies a one way path when in reality Previous Me is the best and worst of all possible futures; a superstate composed upon itself and containing all dread and terror and wonder at once. But mostly, he's just a jerk. Schrodinger's code its only once the code is deployed to prod do you know whether previous you is good or bad
|
# ? Sep 1, 2023 04:55 |
|
It's bad.
|
# ? Sep 1, 2023 10:09 |
|
I'm trying to make a simple blog web app using flask and sqlalchemy, following this tutorial: https://www.youtube.com/watch?v=CSHx6eCkmv0 I can register users fine and their details get added to the database and now I'm trying to log users in (this is at around 28:00 in the video). I've done everything as the tutorial says from what I can see, but when I try to log in, nothing happens. If the login credentials are present and in the right format (the validation of which DOES work because I get messages if they're absent/in the wrong format) it should query the database for the user, and if the credentials are correct redirect to the homepage and flash a message if they're incorrect. Neither of these things happens and it just loads the login page again. This is my login route: Python code:
Python code:
Python code:
Generic Monk fucked around with this message at 18:13 on Sep 2, 2023 |
# ? Sep 2, 2023 18:02 |
|
It's hard to diagnose what's going on without a complete example Post a link to your git repository
|
# ? Sep 2, 2023 19:02 |
|
What does login_user() look like?
|
# ? Sep 2, 2023 19:47 |
|
QuarkJets posted:It's hard to diagnose what's going on without a complete example Good point https://github.com/poisonwomb/flaskblog a dingus posted:What does login_user() look like? I think that's provided by flask_login Generic Monk fucked around with this message at 20:12 on Sep 2, 2023 |
# ? Sep 2, 2023 20:03 |
|
Generic Monk posted:Good point lmao @ being a dude with the github name "poison womb"
|
# ? Sep 2, 2023 21:18 |
|
CarForumPoster posted:lmao @ being a dude with the github name "poison womb" That's amazing idk what you're talkin about
|
# ? Sep 2, 2023 21:21 |
|
CarForumPoster posted:lmao @ being a dude with the github name "poison womb" i had to think of a username for something like 10 years ago and the only thing in my mind at that point was loss.jpg. obv i have a different name whenever i’ve used it for work!!!! Generic Monk fucked around with this message at 21:35 on Sep 2, 2023 |
# ? Sep 2, 2023 21:31 |
|
Chillmatic posted:That's amazing idk what you're talkin about Im talking about how good of a github user name it is a lot to very
|
# ? Sep 2, 2023 21:39 |
|
CarForumPoster posted:Im talking about how good of a github user name it is Nice btw, everyone...python sucks is that truthy or falsy
|
# ? Sep 2, 2023 21:40 |
|
It's both. Bad language for teams of juniors who can't resist doing dumb poo poo, fine for everyone else
|
# ? Sep 2, 2023 21:42 |
|
Python is bad, but better than everything else
|
# ? Sep 2, 2023 21:44 |
|
QuarkJets posted:Python is bad, but better than everything else Empty quoting this
|
# ? Sep 2, 2023 21:50 |
|
Python is bad because its type system is based on pinkie promises and even mypy cannot save you. At least at my company where once a week we have some dumb sentry issue because someone has donecode:
|
# ? Sep 3, 2023 01:57 |
|
|
# ? May 30, 2024 12:19 |
|
Yeah I really wish Python had something like "type hinting is purely optional, but they will be enforced if you specify them." As opposed to "the Python interpreter does not give the slightest gently caress about type hints." Julia has the former as part of its multiple dispatch model, but sadly, adoption of Julia continues to be pretty underwhelming.
|
# ? Sep 3, 2023 02:22 |