-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release: 0.17.1 Characinae Build Pack 1
release: 0.17.1 Characinae Build Pack 1
- Loading branch information
Showing
38 changed files
with
1,320 additions
and
704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands\Scheduling; | ||
|
||
use Illuminate\Console\Command; | ||
use App\Models\ContestModel; | ||
use Carbon; | ||
|
||
class SyncContestProblem extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature='scheduling:syncContestProblem'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description='Scheduling for remote contest problem sync'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$time=Carbon::now(); | ||
$this->line("<fg=yellow>[$time] Processing: </>Sync Remote Contest Problem"); | ||
|
||
$contestModel=new ContestModel(); | ||
$syncList=$contestModel->runningContest(); | ||
foreach ($syncList as $syncContest) { | ||
if (isset($syncContest['crawled'])) { | ||
if (!$syncContest['crawled']) { | ||
$className="App\\Babel\\Extension\\hdu\\Synchronizer"; | ||
$all_data=[ | ||
'oj'=>"hdu", | ||
'vcid'=>$syncContest['vcid'], | ||
'gid'=>$syncContest['gid'], | ||
'cid'=>$syncContest['cid'], | ||
]; | ||
$hduSync=new $className($all_data); | ||
$hduSync->scheduleCrawl(); | ||
$contestModel->updateCrawlStatus($syncContest['cid']); | ||
} | ||
} | ||
} | ||
|
||
$time=Carbon::now(); | ||
$this->line("<fg=green>[$time] Processed: </>Successfully Synced Remote Contest Problem"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands\Scheduling; | ||
|
||
use Illuminate\Console\Command; | ||
use App\Models\ContestModel; | ||
use App\Models\Eloquent\Contest; | ||
use Cache; | ||
use Carbon; | ||
|
||
class SyncRankClarification extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature='scheduling:syncRankClarification'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description='Scheduling for remote rank and clarification sync'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$time=Carbon::now(); | ||
$this->line("<fg=yellow>[$time] Processing: </>Sync Remote Contest Rank and Clarification"); | ||
|
||
$contestModel=new ContestModel(); | ||
$syncList=$contestModel->runningContest(); | ||
foreach ($syncList as $syncContest) { | ||
if (!isset($syncContest['vcid'])) { | ||
$contest=Contest::find($syncContest['cid']); | ||
$contestRankRaw=$contest->rankRefresh(); | ||
$cid=$syncContest['cid']; | ||
Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw); | ||
Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw); | ||
continue; | ||
} | ||
$className="App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. | ||
$all_data=[ | ||
'oj'=>"hdu", | ||
'vcid'=>$syncContest['vcid'], | ||
'gid'=>$syncContest['gid'], | ||
'cid'=>$syncContest['cid'], | ||
]; | ||
$hduSync=new $className($all_data); | ||
$hduSync->crawlRank(); | ||
$hduSync->crawlClarification(); | ||
} | ||
|
||
$time=Carbon::now(); | ||
$this->line("<fg=green>[$time] Processed: </>Successfully Synced Remote Contest Rank and Clarification"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands\Scheduling; | ||
|
||
use Illuminate\Console\Command; | ||
use App\Models\GroupModel; | ||
use Carbon; | ||
use Log; | ||
|
||
class UpdateGroupElo extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature='scheduling:updateGroupElo'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description='Scheduling for group elo update'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$time=Carbon::now(); | ||
$this->line("<fg=yellow>[$time] Processing: </>Update Group Elo"); | ||
|
||
$groupModel=new GroupModel(); | ||
$ret=$groupModel->refreshAllElo(); | ||
foreach ($ret as $gid => $group) { | ||
if (empty($group['result'])) { | ||
Log::channel('group_elo')->info('Refreshed Group Elo (Empty) : ('.$gid.')'.$group['name']); | ||
} else { | ||
Log::channel('group_elo')->info('Refreshing Group Elo: ('.$gid.')'.$group['name']); | ||
foreach ($group['result'] as $contest) { | ||
if ($contest['ret']=='success') { | ||
Log::channel('group_elo')->info(' Elo Clac Successfully : ('.$contest['cid'].')'.$contest['name']); | ||
} else { | ||
Log::channel('group_elo')->info(' Elo Clac Faild (Judge Not Over) : ('.$contest['cid'].')'.$contest['name'].' sids:'); | ||
foreach ($contest['submissions'] as $sid) { | ||
Log::channel('group_elo')->info(' '.$sid['sid']); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
$time=Carbon::now(); | ||
$this->line("<fg=green>[$time] Processed: </>Successfully Updated Group Elo"); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
app/Console/Commands/Scheduling/UpdateJudgeServerStatus.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands\Scheduling; | ||
|
||
use Illuminate\Console\Command; | ||
use App\Models\Eloquent\JudgeServer; | ||
use App\Models\Eloquent\OJ; | ||
use App\Babel\Babel; | ||
use Carbon; | ||
use Exception; | ||
use Log; | ||
|
||
class UpdateJudgeServerStatus extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature='scheduling:updateJudgeServerStatus'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description='Scheduling for JudgeServer status update'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$time=Carbon::now(); | ||
$this->line("<fg=yellow>[$time] Processing: </>Update JudgeServer Status"); | ||
|
||
$platformIDs=JudgeServer::column('oid'); | ||
$babel=new Babel(); | ||
foreach ($platformIDs as $platform) { | ||
try { | ||
$babel->monitor([ | ||
"name" => OJ::findOrFail($platform)->ocode | ||
]); | ||
} catch (Exception $e) { | ||
Log::alert("Moniting OID $platform Failed.\n".$e->getMessage()); | ||
} | ||
} | ||
|
||
$time=Carbon::now(); | ||
$this->line("<fg=green>[$time] Processed: </>Successfully Updated JudgeServer Status"); | ||
} | ||
} |
Oops, something went wrong.