Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select Batch Assigner from Admin Interface #42

Open
ejolly opened this issue Aug 26, 2015 · 3 comments
Open

Select Batch Assigner from Admin Interface #42

ejolly opened this issue Aug 26, 2015 · 3 comments

Comments

@ejolly
Copy link

ejolly commented Aug 26, 2015

I'm not sure if this is currently possible, but it would be convenient to be able to select and attach a new Assigner to a new Batch when it's created directly from the GUI admin interface.

Is there a currently suggested method for doing this programmatically? E.g. in server/

Tracker.autorun(function(){
    Batches.find().forEach(function(batch){TurkServer.Batch.getBatch(batch._id).setAssigner(new TurkServer.Assigners.MyAssigner);
});
@mizzao
Copy link
Member

mizzao commented Aug 26, 2015

Agreed, this would be nice to have. Right now we do it programmatically for most cases (i.e. typing a Meteor.call in the console) because the assigner usually needs to know some parameters when it's instantiated, and those are hard to specify generically from the admin interface. I would be open to finding a better way to do this that would work out of the box yet support a variety of assigner parameters.

P.S. Tracker.autorun isn't currently available on the server side for Meteor, but I get the gist of what you are saying.

@ldworkin
Copy link
Contributor

Yea, I actually thought of adding this feature several times, and it would certainly be easy enough to do it if you assume the assigner doesn't take any parameters.

Currently the way I do this is to put the code in Meteor.startup() rather than some sort of autorun block. That way it gets called every time the server gets restarted. BUT if you create a new batch from the GUI interface, then you have to remember to restart the server. I've been creating new batches from the code directly as well, using upsert, so that they only actually get created once, but then the assigner gets added every time. You can see the pattern I used in server/server.js. Let me know if that makes sense.

@mizzao
Copy link
Member

mizzao commented Aug 26, 2015

That raises another good point - usually the Assigner keeps some state in memory that needs to be preserved if the server restarts or new code is pushed. Right now you'll see that a lot of the more complicated assigners do a bunch of accounting on startup to restore the state that they would be in before a restart. We should think about how this work if assigners can be added and removed from batches directly in the admin interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants