Remember to rm -rf folder{1..30000} after you are done haha
2015-12-18 35251, 2015
Mineo
one file without metadata
2015-12-18 35208, 2015
stanislas
Leftmost, LordSputnik : Should I test all of uris from request (annotation_uri, disambiguation_uri, ...) by checking if they are equal to http://localhost/creator/[id]/[type of uri] or just if they have id in them as a substring ?
My reasoning is that, eventually, we'll want to ensure that our API endpoints are stable. In the meantime, we can change the tests if we change the endpoints.
2015-12-18 35225, 2015
opatel99
Mineo:
2015-12-18 35218, 2015
Mineo
same problem, different file
2015-12-18 35234, 2015
opatel99
terminal?
2015-12-18 35236, 2015
Mineo
opatel99: just curious, which timezone are you actually in?
2015-12-18 35249, 2015
opatel99
UTC-6
2015-12-18 35235, 2015
Leftmost
Giving timezones relative to UTC. <3
2015-12-18 35235, 2015
Mineo
opatel99: there's nothing in the terminal
2015-12-18 35207, 2015
opatel99
Mineo: Any tips ? I am dead.
2015-12-18 35204, 2015
Freso
Leftmost: That's a pretty broad one though. Over half the world.
2015-12-18 35218, 2015
Freso
UTC<0300
2015-12-18 35251, 2015
Leftmost
There's a full stop there. Pretty clear separator.
2015-12-18 35200, 2015
Leftmost
And maybe I just really like the western hemisphere. You don't know.
2015-12-18 35210, 2015
opatel99
Mineo: plez
2015-12-18 35233, 2015
opatel99
And does the metadata not load or does it not cluster?
2015-12-18 35221, 2015
Freso
Leftmost: You kids and your random text formatting these days. You never know when you actually mean your typography and when it's merely for "decoration"
2015-12-18 35259, 2015
opatel99
Full stop. Considered decoration. Only in #metbrainz .
2015-12-18 35221, 2015
Leftmost
I'm consistent in my use of punctuation, good sir.
so create a class of LockableObject that holds an integer and provides methods for incrementing and decrementing that integer and at the beginning of those methods, call lock_for_write and at the end unlock
2015-12-18 35219, 2015
opatel99
ok... I will try real quick
2015-12-18 35219, 2015
Mineo
and then replace the +='s in tagger.py with calls to those
2015-12-18 35254, 2015
opatel99
Mineo: Why is this not always necessary?
2015-12-18 35208, 2015
Mineo
in picard or in general?
2015-12-18 35226, 2015
opatel99
in General
2015-12-18 35236, 2015
Mineo
well, not every application does work in multiple threads, which means there's only ever one thing accessing a variable at one time
2015-12-18 35215, 2015
Mineo
and even in multi-threaded applications, not all threads write every variable
2015-12-18 35251, 2015
opatel99
So what is creating the problem with this variable? Is there a parallel thread that bypasses the addition?
2015-12-18 35203, 2015
Mineo
yes, there are multiple threads loading the files in parallel
2015-12-18 35225, 2015
UmkaDK has quit
2015-12-18 35207, 2015
UmkaDK joined the channel
2015-12-18 35219, 2015
Mineo
and it's not really bypassing, the situation is more like "thread a reads count_file", "thread b reads count file", both create a new temporary value that's count_file + 1, both write that value back to count_file, but the value written last is the one the rest of the application sees
2015-12-18 35241, 2015
Mineo
so instead of the new count_file being the old count_file + 2, it's only old count_file + 1
no, the integer needs to be an attribute of the class because otherwise what would happen is that it gets read, passed into increment and only then do you do lock_for_write
2015-12-18 35249, 2015
Mineo
but that's just the same as before, only with some other operation between reading and incrementing
2015-12-18 35218, 2015
Mineo
the locking needs to happen as it says on wikipedia - before reading the value
2015-12-18 35241, 2015
opatel99
Mineo: got it.
2015-12-18 35244, 2015
Mineo
(and you shouldn't modify the already existing LockableObject class, but create a new one called LockableInteger or something like that that's a subclass of LockableObject)
2015-12-18 35218, 2015
opatel99
so define class, lock for write, make def for increment, exit def, unlock.
2015-12-18 35230, 2015
Mineo
both lock for write and unlock should happen inside the increment method
2015-12-18 35243, 2015
Mineo
I'm not sure where else you'd want to place them, to be honest
you seem to be switching pastebins more often than other people switch their underwear ;-)
2015-12-18 35249, 2015
opatel99
Whatever pops up in my head first.
2015-12-18 35216, 2015
UmkaDK joined the channel
2015-12-18 35208, 2015
Mineo
ok, so you'd want to use this like `x_new = bla.increment(x_old)`, right?
2015-12-18 35219, 2015
opatel99
x_new equal LockableInteger().increment(old)
2015-12-18 35223, 2015
opatel99
something like that
2015-12-18 35226, 2015
opatel99
but yeah
2015-12-18 35232, 2015
Mineo
ok, but between the call to unlock and the assignment to x_new the thread could get suspended again
2015-12-18 35245, 2015
Mineo
and we'd have the same problem as before
2015-12-18 35203, 2015
opatel99
Can we give it shot?
2015-12-18 35211, 2015
opatel99
I do see wht you men.
2015-12-18 35241, 2015
LordSputnik
Leftmost: working on entity models, should I just do <Entity>Header and <Entity>Data for the time being?
2015-12-18 35238, 2015
opatel99
Mineo: So http://hastebin.com/raw/xupohurame would just run into the same error because it calls that method. and the thread instead of handling the increment, one thread handles the lock
2015-12-18 35213, 2015
Mineo
if I understood your last sentence correctly, yes
2015-12-18 35233, 2015
opatel99
So.. is there even a solution?
2015-12-18 35204, 2015
Mineo
what you need to do is make `int` an attribute of lockableinteger, so you don't need to return it and assign it to something else
2015-12-18 35212, 2015
Leftmost
LordSputnik, are either of those really necessary for now?
2015-12-18 35245, 2015
Leftmost
We shouldn't need direct access to those tables.
2015-12-18 35246, 2015
regagain has quit
2015-12-18 35217, 2015
Mineo
that way, when you later want to check the value, you can just do `bla.lock_for_read(); if bla.int == something: ...; bla.unlock()`
2015-12-18 35203, 2015
opatel99
Mineo: setattr(self, int, x_)
2015-12-18 35205, 2015
opatel99
Is that how?
2015-12-18 35235, 2015
LordSputnik
Leftmost: Ok then, I'll do revisions
2015-12-18 35252, 2015
Mineo
opatel99: let's make a deal: you read https://docs.python.org/2/tutorial/classes.html, which covers attributes and explains them better than I can in my tired state, I get some sleep and we'll see how far you've come after I'm alive again ;-)
2015-12-18 35204, 2015
Mineo
because I'm nearly falling asleep in my chair
2015-12-18 35230, 2015
opatel99
Mineo: deal! Hopefully I can finish this my the time you wake up. If not, idk what I can do...
2015-12-18 35252, 2015
Mineo
one more reason for me to sleep extra long
2015-12-18 35232, 2015
opatel99
Mineo: :/
2015-12-18 35240, 2015
reosarevok
haha
2015-12-18 35251, 2015
reosarevok
opatel99: look at the positive side, I guess at least you *are* learning stuff :)
2015-12-18 35223, 2015
opatel99
Definitely. I have been learning a lot about tagger.py for the 6th day. :P. I try to bottle it in though ;)
2015-12-18 35254, 2015
Leftmost
LordSputnik, I need to redo the entity views, right?
2015-12-18 35259, 2015
Leftmost
(Or have you do it?)
2015-12-18 35257, 2015
bitmap
opatel99: if you need help with the locking stuff I can look (no promises on the rest though :))
ok, so the goal is to read & write self.count_dir within the lock, I guess
2015-12-18 35207, 2015
bitmap
but you're passing it to the increment method, so it's still being read before acquiring the lock
2015-12-18 35222, 2015
opatel99
yeah.
2015-12-18 35222, 2015
opatel99
can we call the lock directly in the program. freezing until increment, then immediately release?
2015-12-18 35230, 2015
bitmap
it's certainly possible to use the lock primitives directly
2015-12-18 35239, 2015
bitmap
I like the idea of LockableInteger though, it just needs some work
2015-12-18 35259, 2015
thresh has left the channel
2015-12-18 35223, 2015
opatel99
when Mineo said he wanted an attribute, do I just add a var before the def like the CLasses Python Docs? Therefore I can call LockableInteger.var
2015-12-18 35228, 2015
oliverl_ joined the channel
2015-12-18 35238, 2015
bitmap
you'll want to add a def __init__ there and do `this.int = 0` inside to initialize it
2015-12-18 35240, 2015
oliverl has quit
2015-12-18 35206, 2015
bitmap
in Tagger's __init__, you have `self.count_dir = 0
2015-12-18 35237, 2015
bitmap
` right now, but it should be self.count_dir = LockableInteger()
2015-12-18 35239, 2015
opatel99
I was thinking of having all those counters in the Lockable Integer?
2015-12-18 35215, 2015
bitmap
if they're all being read and written by multiple threads, then yes
2015-12-18 35226, 2015
opatel99
So this will standardize the values
2015-12-18 35235, 2015
bitmap
if there's only a small section of code where they're all being read/written to, then you could get away with a single lock for that entire section of code
2015-12-18 35214, 2015
opatel99
bitmap: It is included in a more important part of adding/loading files. I dont know if that would play nice.
2015-12-18 35255, 2015
dcentral has quit
2015-12-18 35201, 2015
LordSputnik
Leftmost: Either one of those two
2015-12-18 35232, 2015
bitmap
well, you're going to need an exclusive lock, the question is how many :)
2015-12-18 35250, 2015
triggerwarning has quit
2015-12-18 35257, 2015
opatel99
bitmap: Is 4 the safe route? just turn each of my counters into a Lock instance
2015-12-18 35200, 2015
Leftmost
Okay. I'll try to get to some BB stuff this weekend. Next week is a bit crazy for me.
2015-12-18 35205, 2015
bitmap
it depends on whether you want the values to be consistent with eachother in a section of code
2015-12-18 35243, 2015
opatel99
bitmap: Is this just like what QSEmaphore does?
2015-12-18 35238, 2015
bitmap
I think LockableObject uses a mutex, which is a type of semaphore
2015-12-18 35243, 2015
bitmap
a semaphore lets you say "N threads can access this section of code at once"