BATCH_SQL_INSERT_NUM
BATCH_SQL_INSERT_NUM
Number of inserts to try to group into a single insert statement before execution
Recommendation Job recommends the trending threads as well as threads and groups which are relevant based on the users viewing history
Subclasses should implement methods they use among init(), checkPrerequisites(), nondistributedTasks(), prepareTasks(), finishTasks(), getTasks(), doTasks(), and putTask(). MediaUpdating can be configured to run in either distributed or nameserver only mode. In the former mode, prepareTasks(), finishTasks() run on the name server, getTasks() and putTask() run in the name server's web app, and doTasks() run on any MediaUpdater clients. In the latter mode, only the method nondistributedTasks() is called by the MediaUpdater and by only the updater on the name server.
__construct(object $media_updater = null, object $controller = null)
Instiates the MediaJob with a reference to the object that instatiated it
object | $media_updater | a reference to the media updater that instatiated this object (if being run in MediaUpdater) |
object | $controller | a reference to the controller that instantiated this object (if being run in the web app) |
doTasks(array $tasks) : mixed
This method is run on MediaUpdater client with data gotten from the name server by getTasks. The idea is the client is supposed to then this information and if need be send the results back to the name server
array | $tasks | data that the MediaJob running on a client MediaUpdater needs to process |
the result of carrying out that processing
getTasks(integer $machine_id, array $data = null) : array
Method called from JobController when a MediaUpdater client contacts the name server's web app. This method is supposed to marshal any data on the name server that the requesting client should process.
integer | $machine_id | id of client requesting data |
array | $data | any additional info about data being requested |
work for the client to process
putTasks(integer $machine_id, mixed $data) : array
After a MediaUpdater client is done with the task given to it by the name server's media updater, the client contact the name server's web app. The name servers web app's JobController then calls this method to receive the data on the name server
integer | $machine_id | id of client that is sending data to name server |
mixed | $data | results of computation done by client |
any response information to send back to the client
execNameServer(string $command, string $args = null) : array
Executes a method on the name server's JobController.
It will typically execute either getTask or putTask for a specific Mediajob or getUpdateProperties to find out the current MediaUpdater should be configured.
string | $command | the method to invoke on the name server |
string | $args | additional arguments to be passed to the name server |
data returned by the name server.
computeUserItemIdf(integer $number_items, integer $number_users)
Computes inverse document frequencies for each term for each user and for each item. That is, for a particular term, it will compute the number of times a user used that term in a post/the number of posts by that user and take the log of the result. For items, the idea is similar, for each thread, one calculates the number of posts that the term appeared in/the total number of posts in the thread and take the log of the result.
integer | $number_items | number of items |
integer | $number_users | number of users |
calculateSimilarityRecommendations(integer $recommendation_type, $similarity_sql, integer $max_recommendations)
Computes up to $max_recommendations item recommendations of the given type (thread or group) based on query which computes similarity score between a user and a given type.
integer | $recommendation_type | a config.php constant indicating the type of recommendation to compute |
$similarity_sql | query used to determine user similarity scores should output triples: (user_id item_id rating) |
|
integer | $max_recommendations | maximum number of recommendations to compute per user |