The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2015-06-23

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:09 Kogurr joined #mojo
01:13 cpan_mojo Mojolicious-Plugin-ParamExpand-0.03 by SHAW https://metacpan.org/release/SHAW/Mojolicious-Plugin-ParamExpand-0.03
01:17 klapperl_ joined #mojo
01:33 asarch joined #mojo
01:45 cpan_mojo Mojolicious-Plugin-FormFields-0.05 by SHAW https://metacpan.org/release/SHAW/Mojolicious-Plugin-FormFields-0.05
01:57 mattastrophe joined #mojo
02:14 noganex joined #mojo
02:31 hshong joined #mojo
02:40 woz joined #mojo
03:09 bin_005 joined #mojo
03:49 davido_ joined #mojo
03:51 woz joined #mojo
04:22 storskegg joined #mojo
04:54 melo joined #mojo
04:54 woz joined #mojo
04:59 zivester joined #mojo
05:36 dod joined #mojo
05:42 dod joined #mojo
05:52 dod joined #mojo
05:58 woz joined #mojo
06:14 dod joined #mojo
06:23 kaare joined #mojo
06:24 woz joined #mojo
06:30 dod joined #mojo
06:38 marcusr joined #mojo
06:39 marcusr joined #mojo
06:41 jberger joined #mojo
06:48 ans joined #mojo
07:07 marmez joined #mojo
07:07 marmez left #mojo
07:13 eseyman joined #mojo
07:14 Vandal joined #mojo
07:21 amon joined #mojo
07:23 odc joined #mojo
07:26 trone joined #mojo
07:42 mattastrophe1 joined #mojo
07:53 ToApolytoXaos joined #mojo
08:04 dod joined #mojo
08:12 ans1 joined #mojo
08:29 bin_005 joined #mojo
08:48 batman is this a bug? https://github.com/kraih/mojo/issues/813
08:48 batman i would close it with "change your temp dir"
08:48 batman sri_: ^
09:14 bd joined #mojo
09:14 bd hi
09:14 purl hello, bd.
09:18 batman hi
09:18 purl what's up, batman.
09:19 bd i want to "call" a route every n seconds from within my mojoliciois app. i came up with Mojo::IOLoop->timer(1 => sub { ... $self->ua->post( $url => ... ) }); but i have no idea on how generate the $url. the route in question has a name.
09:22 batman bd: $self->ua->post("/whatever", ...)
09:22 batman you don't have to specify the full url, when using $app->ua
09:31 dotan1 joined #mojo
09:46 berov joined #mojo
09:49 dexteruk_ joined #mojo
09:53 dotan joined #mojo
10:04 dotan joined #mojo
10:23 woz joined #mojo
10:41 berov1 joined #mojo
10:56 cpan_mojo Mojo-Webqq-1.3.5 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-1.3.5
11:01 mattastrophe joined #mojo
11:10 dod joined #mojo
11:14 dotan joined #mojo
11:16 illywhacker joined #mojo
11:23 storskegg joined #mojo
11:36 woz joined #mojo
12:00 neilhwatson joined #mojo
12:02 KimmoNO joined #mojo
12:07 sri_ jberger: heh
12:07 jberger You beat me to it!
12:11 CandyAngel joined #mojo
12:12 sri_ by about 3 seconds :o
12:14 CandyAngel Is it possible to have Minion workers in their own file and set which tasks they can handle?
12:14 CandyAngel So I can separate them out and stuff?
12:15 jberger CandyAngel: minion workers can be set to only handle certain tasks
12:15 jberger As to having their own file, you can make different minion instances, but there usually isn't much need for that
12:16 jberger You might want to look into having a db backed worker pool though
12:16 CandyAngel I think File is fine for now, it's only running locally
12:17 CandyAngel I want to make a front end that shows shows the tasks and the status as various Minion workers handle them
12:17 jberger CandyAngel: I actually already have most of such a front end in my github
12:18 jberger If anyone wants to bring it over the finish line, that would be cool
12:19 jberger https://github.com/jberger/Minion-Command-minion-monitor
12:19 CandyAngel The reason why I want to separate the workers is that what they will be doing is pretty substantial
12:19 espen hi, I'm trying to get Mojolicious::Plugin::LeakTracker to wor, but the 'request' event never seems to fire here: https://github.com/benvanstaveren/Mojolicious-Plugin-LeakTracker/blob/master/lib/Mojolicious/Plugin/LeakTracker.pm#L62
12:20 espen does anyone see what the problem is or have any suggestions on what do do to fix this?
12:20 CandyAngel So rather than having a boatload of code in the app, each worker "type" would be in its own file
12:21 sri_ CandyAngel: you want app specific plugins
12:21 jberger CandyAngel: oh you want to put the task definition in it's own file?
12:21 sri_ http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Adding-a-plugin-to-your-application
12:21 jberger Yeah, like sri said, put them in a plugin
12:21 batman (sri_, jberger)++
12:22 CandyAngel So like.. I have an app which is the frontend but which shows the status and allows me to add tasks
12:22 sri oh, Grinnz has taken over the channel :o
12:22 CandyAngel Then the worker that can handle task_a is in minion_task_a.pl
12:23 CandyAngel And I would start a worker from minion_task_a.pl
12:23 CandyAngel Sorry if I am not explaining this properly >.<
12:23 jberger sri we probably should just get mst to hook up ChanServ on #mojo anyway
12:24 Kripton joined #mojo
12:24 jberger CandyAngel: adding tasks while the servers are running isn't likely to do what to do what you want
12:24 CandyAngel Oh!
12:24 CandyAngel No, I mean errr.. queuing tasks
12:25 jberger Ok sure
12:25 jberger (Yeah the terminology gets tricky)
12:26 CandyAngel My little test thing has app -> minion -> add_task ('scan_dir' => sub...
12:26 jberger Anyway I think you are worrying about separating things prematurely
12:26 CandyAngel In the main Mojo application
12:26 CandyAngel I just want to put it in its own file
12:26 jberger Plugins
12:27 CandyAngel Hmm
12:27 * sri just makes plugins that he calls MyApp::Task::Foo
12:27 CandyAngel sri: And you have the code that performs the task there?
12:27 jberger A plugin's register method is basically just a way to move code from startup into another file
12:27 sri $self->plugin('MyApp::Task::Foo')
12:28 CandyAngel Ohhhhh
12:28 CandyAngel I think I get it
12:28 jberger Oh a like the choice of namespace though
12:28 jberger sri++
12:28 CandyAngel So you move the app -> minion -> add_task to the plugin
12:29 sri yes
12:29 CandyAngel And then just start minions with.. -t scan_dir
12:29 CandyAngel And they will run the code in the plugin with the job?
12:30 sri yes
12:30 jberger All the minions will get all the task definition
12:30 jberger But they will only perform the ones to let them with -t
12:30 CandyAngel Yeah
12:30 CandyAngel That sounds pefect
12:30 CandyAngel perfect*
12:33 ajr_ joined #mojo
12:33 CandyAngel And it makes a lot more sense than what I was thinking of :P
12:34 CandyAngel So I shall implement that and then see about WebSockets and stuff..
12:34 CandyAngel Thank you!
12:34 jberger CandyAngel: see if that github repo it's a way to get started
12:35 jberger s/it's/is/
12:35 sri jberger: you should finish it yourself!
12:36 jberger I should, but I've been busy!
12:36 jberger Actually, phantom came about because I wanted a way to test that front end
12:37 jberger So note that I have it maybe I can continue
12:37 jberger Now! Damn you swipe type
12:39 woz joined #mojo
12:54 storskegg joined #mojo
13:00 dvinciguerra joined #mojo
13:04 CandyAngel Hmm.. not sure if I am doing something wrong but I'm not seeing any errors if add_task doesn't get a valid subroutine?
13:14 CandyAngel Okay, I got that aspect working in my little test and it makes sense to me :)
13:19 espen seems like the request event in Mojo::Transaction::HTTP doesn't fire when I'm running my app with plackup
13:19 espen this example reproduces the issue: https://gist.github.com/espizo/362d7f3d5bbc30c49350
13:19 espen could anyone take a look?
13:20 sri a lot of events don't get emitted for PSGI servers
13:20 espen hmm ok
13:26 gryphon joined #mojo
13:43 woz joined #mojo
13:53 storskegg joined #mojo
14:02 jberger sri: that's interesting
14:02 jberger I guess that's because the PSGI interface does some of the message parsing etc?
14:09 sri yes
14:10 jberger #813 just hit the "magic non-blocking" territory again
14:11 sri :S
14:11 sri there's IO::AIO, but that's out of the question for core
14:12 jberger right
14:12 jberger I'm thinking of going lehmann-free soon
14:13 jberger I have a module on CPAN that depends on Coro (deeply), and I'm wondering what to do about it
14:13 batman jberger: rm -rf ;=)
14:13 Grinnz_ jberger: i think Leonerd has some ideas there
14:14 jberger Grinnz_: I'm not sure that LeoNerd's async/await would help https://metacpan.org/pod/Generator::Object
14:17 sri jberger: https://metacpan.org/pod/Generator::Object#COPYRIGHT-AND-LICENSE
14:17 sri that ends with a 1;
14:18 jberger hahahaha
14:18 purl LOLCON 4 reached.
14:18 jberger well why not?!
14:19 jberger hmmmm, seems strange that it loads then
14:19 jberger what is the last executable statement?
14:19 jberger is it $VERSION = eval $VERSION?
14:21 jberger yes
14:22 jberger that is the return value of do-loading the module
14:22 jberger hahahah
14:23 Grinnz_ lol
14:24 jberger anyway, its fixed in git, if I ever release another version of that module
14:25 jberger of course I couldn't try it on 5.22 (my current perl) because Coro doesn't load on 5.22
14:25 Grinnz_ gotta get that stableperl!
14:25 * jberger throws up a little in his mouth
14:25 jberger of all the reasons to fork perl
14:26 mst This is NASA control. The toys launched from Pram One have reached escape velocity.
14:26 jberger open the pod bay doors hal
14:27 jberger (oh I though purl had a factoid for that)
14:27 jberger ah
14:27 jberger open the pod bay doors
14:27 purl I'm sorry, jberger, I'm afraid I can't do that.  I still have the utmost confidence in the mission.
14:43 jberger I'm thinking of removing the ioloop attribute on ForkCall for an upcoming release
14:44 jberger I'm a bit torn, but it seems like it should always operate on the singleton
14:44 zackiv31 joined #mojo
14:44 Grinnz_ i have never -not- used the singleton for anything, so i dont know if i can comment really
14:45 jberger I know that that is how you can trick a non-blocking process into blocking
14:45 jberger but why would you ever use ForkCall and trick it into blocking something else
14:45 Grinnz_ heh
14:45 jberger that's why you are using it in the first place!
14:46 jberger I can't think of any other reason to have two running parallel ioloops
14:46 woz joined #mojo
14:47 Kogurr joined #mojo
14:48 storskeg_ joined #mojo
14:48 mattastrophe joined #mojo
14:49 human39 joined #mojo
14:53 jberger hmmm, forking and then calling $asset->move_to has a tiny gotcha
14:54 jberger the $asset object doesn't get updated in the parent
14:54 Grinnz_ indeed, you would need to return/assign it back or something
15:01 jberger Grinnz_: https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L57-L60
15:01 jberger ^^ why you have an ioloop attribute on the user agent
15:02 Grinnz_ is it possible to make forkcall run in "blocking" mode like that?
15:02 jberger the secondary one blocks the the singleton/primary, thereby emulating a blocking agent even when the singleton is running
15:02 jberger Grinnz_: sure, by why would you
15:02 Grinnz_ that's the question :P
15:02 jberger people sometimes want to make blocking ua requests, but why make blocking non-blocking forks?
15:03 Grinnz_ because a regular fork and wait isn't complex enough
15:03 Grinnz_ but actually, you could use that to take advantage of forkcall's "send stuff back from the fork" functionlaity i guess :P
15:05 jberger hmmm, I suppose
15:06 CandyAngel Hmm.. thinking ahead a little.. if I have a Minion job that fails, can I restart it after giving it some new info?
15:06 jberger what I worry about is this: https://metacpan.org/source/JBERGER/Mojo-IOLoop-ForkCall-0.17/lib/Mojo/IOLoop/ForkCall.pm#L47-49
15:07 CandyAngel So for example, if it fails a check I've put in, I can make a "force" button which will set it back to inactive with $job -> info->{'force'} set?
15:09 jberger CandyAngel: IIRC you can't modify a job after it has been queued
15:09 jberger at least not via public functionality
15:09 jberger you could probably clone and re-queue a job though
15:09 CandyAngel That's unfortunate
15:09 CandyAngel yeah
15:10 CandyAngel Ideally, I'd be able to link jobs together so a Minion gets a job and launches other jobs with a reference to the "parent" job
15:11 CandyAngel So I the scan_dir job runs, does whatever and queues more jobs
15:12 CandyAngel And in the frontend, it can group them
15:12 jberger CandyAngel: you are thinking in terms of high-level human interactivity
15:12 jberger minion is lower level than that
15:12 jberger you could build it out of the primatives though
15:12 CandyAngel If I can put whatever i want in $job -> info, I think I can do it
15:13 jberger hahah, I don't know if that is writeable
15:13 CandyAngel I can set 'state' and 'result' in it (it returns a hashref)
15:13 CandyAngel I think?
15:13 jberger it returns a hashref, but do changes get saved back to the db?
15:14 CandyAngel I don't know.. I'm not sure what, if any, magic is happening
15:14 CandyAngel Might be key restricted
15:14 jberger almost no magic
15:14 jberger not key restricted, think in terms of storage location
15:14 jberger the job data that matters after queueing it is in the db
15:15 jberger so even if you hold an info hashref and modify it, it means little if you can't write those changes back to the job definition row in the db
15:15 CandyAngel Ohhh, I see what you are getting at
15:16 CandyAngel Well, you can set 'result' from the minion
15:16 CandyAngel And to requeue it, I have to create a new job anyway, which will write the new job.. whether writes my key or not is another matter.. *ponderponder*
15:21 CandyAngel Oh, I don't think it even write $job -> info to the job database anyway
15:21 CandyAngel Minion::Job: sub info { $_[0]->minion->backend->job_info($_[0]->id) }
15:21 CandyAngel Or if it does, it isn't actually part of the job object..
15:21 jberger right, that's what I was worried about
15:22 jberger think about it in terms of auditing though
15:23 PryMar56 joined #mojo
15:23 jberger I'm not sure I would want systems to be able to update failed jobs, because when I come back to see why things are failing, if they have been monkeyed with by errant job running bots how do I know what really happened when?
15:24 CandyAngel Application log?
15:24 jberger you could write your task description to look itself up in the db and check the number of retries and set force if retries > 0
15:25 jberger does the job itself know what its id is?
15:25 jberger I would guess that it does
15:25 CandyAngel Yeah
15:26 CandyAngel There are some situations where I want it to auto retry (e.g. file is locked, try again in 10 seconds, 6 times)
15:26 CandyAngel And other situations where it needs to fail, then show up on the frontend with a 'force' button
15:27 CandyAngel Oh
15:28 CandyAngel Duh, if I submit a new job in its place, I can pass 'force' => 1 as an argument :P
15:28 CandyAngel Maybe i just need to have a play and see what it lets me do
15:29 jberger right, that's certainly what you would do if you if you can requeue
15:29 jberger enjoy
15:37 dvinciguerra joined #mojo
15:40 CandyAngel Oh, $job already has a retry thing, with delay no less.
15:41 CandyAngel that must mean there is a way of storing how many retries or it would retry indefinitely :/
15:42 jberger it does have a count of retries in the row/job info
15:42 sri https://github.com/kraih/minion/blob/master/t/file.t#L258
15:45 CandyAngel Ah okies, just not mentioned in the docs :)
15:45 CandyAngel Thankies!
15:46 mst likely because it's an implementation detail upon which you shouldn't depend
15:47 CandyAngel mst: But being able to retry and never knowing how many times you have results in you not being able to escape infinite failures..
15:48 sri the information is actually available in the public api... but yea, i'm not entirely sure about it yet... so it's undocumented for now
15:48 mst CandyAngel: that sentence didn't make any sense
15:48 CandyAngel mst: Sorry
15:48 woz joined #mojo
15:49 CandyAngel What I mean is, if the Minion sets the job to be retried when it fails, if it can never succeed, it will retry forever
15:50 mst well, yes, that would be silly, but it doesn't do that :)
15:50 CandyAngel how does it not?
15:51 CandyAngel Say, for example, you have task code like this
15:52 CandyAngel my $job = shift; if (1 == 0) { $job -> retry; }
15:52 sri CandyAngel is correct, you need that information to prevent endless restarting
15:52 mst oh, you mean if you intentionally code a bug into your handler, now you have a bug
15:52 mst that explains why I didn't understand the first time
15:53 mst it didn't occur to me that needed saying, sorry
15:53 CandyAngel It isn't a bug, it's an example
15:53 CandyAngel UA timeout is 5 seconds
15:53 CandyAngel Server takes 10 seconds to respond
15:53 CandyAngel Infinite loop of retries
15:54 CandyAngel Or server returns HTTP 500, so you retry
15:54 CandyAngel But it always returns 500
15:55 sri i'll document what information is available
15:55 sri minion should be stable enough
15:58 CandyAngel sri: Thankies
16:19 ans joined #mojo
16:22 sri and done https://github.com/kraih/minion/commit/0102f08a1db382745ab283be2f0df305719d1b35
16:32 jberger sri++
16:36 disputin joined #mojo
16:51 woz joined #mojo
16:51 joe joined #mojo
16:59 CandyAngel sri: That was fast, thank you very much :)
17:00 joe Is there a way to test url_for expressions on the commandline, via 'eval' ?
17:01 joe Mojolicious::Controller->new->url_for(..) complains about "Can't call method "req" on an undefined value"
17:01 sri app->build_controller->...
17:03 joe fabulous -- thank you sri
17:04 jberger probably don't even have to build_controller though right?
17:04 jberger app->url_for ?
17:04 jberger has a helper alias to the controller
17:05 joe thank you too jberger
17:06 ajr_ joined #mojo
17:08 sh4 joined #mojo
17:25 dod joined #mojo
17:40 augensalat This little script doesn't work as expected: https://gist.github.com/augensalat/caad97c62fb375dd4f4c
17:40 augensalat The last read event happens after close and after the request callback. Can somebody explain why?
17:42 Grinnz augensalat, probably because the last read event triggers the request callback.
17:42 Grinnz and then your read callback
17:42 Grinnz (i'm just guessing here)
17:44 augensalat Grinnz: this doesn't  sound intuitive. I would expect write, read, read, read, ..., close and finally request callback
17:45 augensalat maybe it is my fault, but I ca't see it
17:45 augensalat can't
17:46 Grinnz try using this event instead: https://metacpan.org/pod/Mojo::Content#read as detailed here: https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Streaming-response
17:47 augensalat Yes, i found that too, but still I'd like to understand my problem with Mojo::IOLoop::Stream events
17:48 Grinnz the IOLoop::Stream has no context of the user agent transaction, I would say
17:49 Grinnz i dunno. i don't do much with raw streaming dat
17:49 Grinnz data *
17:51 asarch joined #mojo
17:54 augensalat I have to sometimes. It seems good enough in Plugin::AccessLog, but I also have some kind of research plugin, that (i.a.) logs up- and download traffic - and there i have the same problem.
17:55 woz joined #mojo
17:55 mst 48
17:56 DaTa Grinnz --
18:03 trone joined #mojo
18:57 woz joined #mojo
18:59 melo joined #mojo
19:14 lluad joined #mojo
19:21 * batman doesn't get... why "Grinnz --" ?
19:21 Grinnz_ he was higlighting me back i think ;P
19:24 batman :)
19:29 batman jberger: i think forkcall example without oo looks better (ref #813)
19:29 jberger when used alone that might be true
19:29 jberger but usually you use it with delay and then it looks fine
19:30 jberger also, non-oo has real problems before 5.14
19:30 jberger (and the whole thing has problems on windows anyway, which sucks)
19:33 coolo joined #mojo
19:37 wingfold joined #mojo
19:50 batman ok. didn't know
19:50 purl ignorance is no excuse
19:50 batman purl: of course it is.
19:50 purl batman: i'm not following you...
19:51 jberger botsnack
19:51 purl thanks jberger :)
19:59 woz joined #mojo
20:01 trone joined #mojo
20:05 aggrolite joined #mojo
20:30 gretchen joined #mojo
20:31 woz joined #mojo
20:42 gretchen left #mojo
20:44 sri think i might stop commenting on #812
20:45 sri think i've explained the problem like 5 times in different places now
20:45 batman sri: yeah...
20:45 batman i have a prediction: it will be closed for comments :/
20:46 sri don't think so
20:46 batman hope not :)
20:47 batman i think there's too many who has strong feelings about the direction validation should take, without understanding the consequences
20:48 batman i just don't get how it could work in a consistent way...
20:49 sri don't think it can, you'd have to differentiate between checks for POST/GET params and for uploads
20:51 sri ->required('some_uploaded_file')->upload->file_size(0, 1024 * 1024 * 1024)
20:51 sri something like that
20:51 purl something like that is totally possible
20:51 sri purl: indubitably
20:51 purl sri: sorry...
20:52 batman that doesn't make any sense to me.
20:52 sri i'd be totally up for discussing the design... but people just don't want to think about it too much
20:52 batman but on the other hand... token() didn't make any sense either to me in the beginning :P
20:53 batman i just don't want to (need to?) validate uploads, hehe...
20:53 sri ->required makes sure there's a value, ->upload is a check that makes sure it's a Mojo::Upload object, and ->file_size checks the size of the upload for a certain range without loading anything into memory
20:55 sri or just make it consistent with ->required('some_upload')->file->file_size(0, 1024)
20:55 sri and use file_* as a convention for uploads
20:55 sri ->file_name_like(qr/\d+/)
20:56 batman where does file() get the file object from? is it in $v->input ?
20:56 sri yes
20:56 sri as a Mojo::Upload object
20:56 batman so you could just do ->required('some_upload')->file_size(0, 1024) directly?
20:57 sri directly?
20:57 purl it has been said that directly is a better idea than using AUTOLOAD
20:57 jberger if you can merge in the upload objects into input, I think it makes sense to do it
20:57 batman yeah, without calling ->file first
20:57 sri jberger: it's a one-liner
20:57 sri batman: sure
20:57 batman ok.
20:57 sri batman: but it could break
20:57 sri because file_checks would assume the value is an object
20:58 jberger batman: what if I don't care what size it is, but I want to ensure that it is a file
20:58 Grinnz_ it might get some_upload as a GET/POST param
20:58 batman sri: i think what you're suggesting is possible to do now -- not in core, but in an application.
20:58 batman or in a plugin.
20:58 purl in a plugin is there a way to fetch the base uri?
20:58 sri batman: you'd have to merge the uploads manually
20:58 sri but yes
20:58 sri you could do it
20:58 jberger if its a one-liner, I'd say do it in core
20:59 jberger (obviously a few new checks of course too)
21:00 batman sri: $c->validation->input->{$_->name} = $_ for @{$msg->uploads}
21:00 batman ?
21:00 sri something like that, yea
21:00 batman sri: should be super simple to do this experimentally in a plugin...
21:01 sri think i mentioned that yesterday already ;p
21:01 batman i'm 110% sure you did :)
21:02 batman jberger: i say "don't do it in core". i have no idea what happens if that is done.
21:02 sri what i'm worried about is confusion over the different core checks
21:02 sri like i said before! ;p
21:02 batman sri: want to review this "plugin" if i make one tomorrow? maybe we could get some feedback on a "working" plugin before adding it to core?
21:02 sri ->size() and friends
21:03 sri (6th time now?)
21:04 batman i meant as in would you actively look at it or am i wasting our time?
21:04 batman i don't really want it. i just want to make a poc to see what happens...
21:08 * batman will sleep on it
21:08 batman take care
21:41 woz joined #mojo
21:54 kaare joined #mojo
22:42 woz joined #mojo
23:03 trone joined #mojo
23:05 lluad_ joined #mojo
23:11 mattastrophe joined #mojo
23:16 dvinciguerra joined #mojo
23:44 woz joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary