How to manually run pending tasks in Craft CMS 3
Craft 3 default action to run the queue is 

public function actionRun(): Response
{
    // Prep the response
    $response = Craft::$app-&gt;getResponse();
    $response-&gt;content = '1';

    // Make sure Craft is configured to run queues over the web
    if (!Craft::$app-&gt;getConfig()-&gt;getGeneral()-&gt;runQueueAutomatically) {
        return $response;
    }

    // Make sure the queue isn't already running, and there are waiting jobs
    $queue = Craft::$app-&gt;getQueue();
    if ($queue-&gt;getHasReservedJobs() || !$queue-&gt;getHasWaitingJobs()) {
        return $response;
    }

    // Attempt to close the connection if this is an Ajax request
    if (Craft::$app-&gt;getRequest()-&gt;getIsAjax()) {
        $response-&gt;sendAndClose();
    }

    // Run the queue
    $queue-&gt;run();

    return $response;
}


So all you need is Craft::$app-&gt;getQueue()-&gt;run(). Every Craft 3 project comes with a default module so you can Enhancing a Craft CMS 3 Website with a Custom Module or if You Wanna Make a Craft 3 Plugin?