push a job onto the queue
342571
public function enqueue(Job\WrappedJob $job) {
        $this->repo->addJob($job, $this->name);
    }
1005887
protected function pushJobs() : bool
    {
        // Skip if no jobs currently in queue
        if (empty($this->jobQueues)) {
            return true;
        }

        // Run trough list of (idle) workers and check if there is a job in queue the worker can handle
        foreach ($this->workerStates as $workerId => $workerState) {
            if ($workerState !== Worker::WORKER_STATE_IDLE) {
                continue;
            }
            $jobData = $this->getJobFromQueue($workerId);
            if (empty($jobData)) {
                continue;
            }
            try {
                $this->workerStats[$workerId]++;
                $this->workerJobMap[$workerId] = $jobData['job_id'];
                $this->workerJobSocket->send($jobData['job_name'], \ZMQ::MODE_SNDMORE);
                $this->workerJobSocket->send($jobData['job_id'], \ZMQ::MODE_SNDMORE);
                $this->workerJobSocket->send($workerId, \ZMQ::MODE_SNDMORE);
                $this->workerJobSocket->send($jobData['payload']);
            } catch (\ZMQException $e) {
                $this->logger->error('Error sending job to worker: ' . $e->getMessage());
            }
        }

        return true;
    }
88476
def insert(self):
        
        from google.appengine.api.taskqueue import Queue

        task = self.to_task()

        Queue(name=self.get_queue()).add(task)
934230
def _push(host, port, q, done, mps, stop, test_mode):
    """"""
    sock = None
    retry_line = None
    while not ( stop.is_set() or ( done.is_set() and retry_line == None and q.empty()) ):
        stime = time.time()

        if sock == None and not test_mode:
            sock = _mksocket(host, port, q, done, stop)
            if sock == None:
                break

        if retry_line:
            line = retry_line
            retry_line = None
        else:
            try:
                line = q.get(True, 1)  # blocking, with 1 second timeout
            except:
                if done.is_set():  # no items in queue, and parent finished
                    break
                else:  # no items in queue, but parent might send more
                    continue

        if not test_mode:
            try:
                sock.sendall(line.encode('utf-8'))
            except:
                sock = None  # notify that we need to make a new socket at start of loop
                retry_line = line  # can't really put back in q, so remember to retry this line
                continue

        etime = time.time() - stime  #time that actually elapsed

        #Expected value of wait_time is 1/MPS_LIMIT, ie. MPS_LIMIT per second.
        if mps > 0:
            wait_time = (2.0 * random.random()) / (mps)
            if wait_time > etime:  #if we should wait
                time.sleep(wait_time - etime)  #then wait

    if sock:
        sock.close()
1057380
def enqueue_jobs(self, jobs: Iterable[Job]):
        """"""
        jobs_to_queue = list()
        for job in jobs:
            if job.should_start:
                job.status = JobStatus.QUEUED
            else:
                job.status = JobStatus.WAITING
            jobs_to_queue.append(job.serialize())

        if jobs_to_queue:
            self._run_script(
                self._enqueue_job,
                self._to_namespaced(NOTIFICATIONS_KEY),
                self._to_namespaced(RUNNING_JOBS_KEY.format(self._id)),
                self.namespace,
                self._to_namespaced(FUTURE_JOBS_KEY),
                *jobs_to_queue
            )
1151369
def push(self, record, shard):
        
        heapq.heappush(self.heap, heap_item(self.clock, record, shard))
923033
def put(self, item, block=True, timeout=None):
        """"""
        return self._queue.put(item, block, timeout)
156003
function enqueue(queue, update) {
  if (update) {
    queue = queue || [];
    queue.push(update);
  }
  return queue;
}
62864
private void makeJobRunning(JobInProgress job, JobSchedulingInfo oldInfo, 
                              QueueInfo qi) {
    // Removing of the job from job list is responsibility of the
    //initialization poller.
    // Add the job to the running queue
    qi.addRunningJob(job);
  }
1241389
@Override
    public final Job queueIn(final Job job, final long millis) {
        return pushAt(job, System.currentTimeMillis() + millis);
    }
283820
public function push( $job, $data = '', $queue = null )
	{
		$queueJob = $this->resolveJob( $this->createPayload( $job, $data, $queue ) );

		try
		{
			$this->raiseBeforeJobEvent( $queueJob );

			$queueJob->fire();

			$this->raiseAfterJobEvent( $queueJob );
		}
		catch ( Exception $e )
		{
			$this->raiseExceptionOccurredJobEvent( $queueJob, $e );

			$this->handleFailedJob( $queueJob );

			throw $e;
		}
		catch ( Throwable $e )
		{
			$this->raiseExceptionOccurredJobEvent( $queueJob, $e );

			$this->handleFailedJob( $queueJob );

			throw $e;
		}

		return 0;
	}
19226
def queue(id)
      Log.debug "Queuing held job id #{id}"
      job = @jobs_by_id[id]
      job.owner = nil
      job.time_start = Time.now
      job.time_end = nil
      job.status = Executor::STATUS_NONE
      self.push(job)
    end
1150782
public void pushAdd(CollectorRegistry registry, String job) throws IOException {
    doRequest(registry, job, null, "POST");
  }
269709
def put(self, event, *args, **kwargs):
        
        self._queue.put((event, args, kwargs))
347313
def pass_job(db: JobDB, result_queue: Queue, always_cache=False):
    
    @pull
    def pass_job_stream(job_source):
        """Pull stream instance created by `pass_job`."""
        result_sink = result_queue.sink()

        for message in job_source():
            if message is EndOfQueue:
                return

            key, job = message
            if always_cache or ('store' in job.hints):
                status, retrieved_result = db.add_job_to_db(key, job)

                if status == 'retrieved':
                    result_sink.send(retrieved_result)
                    continue

                elif status == 'attached':
                    continue

            yield message

    return pass_job_stream
699974
public void push(CollectorRegistry registry, String job, Map<String, String> groupingKey) throws IOException {
    doRequest(registry, job, groupingKey, "PUT");
  }
947729
public function push($job, $data = '', $queue = null)
    {
        $id = $this->storeJob($job, $data, $queue);

        return 0;
    }