-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from Bot-detector/mono-repo
mono repo style
- Loading branch information
Showing
10 changed files
with
109 additions
and
158 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from . import logging | ||
|
||
logging.handlers | ||
__all__ = ["logging"] |
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 |
---|---|---|
|
@@ -243,4 +243,4 @@ async def main(): | |
|
||
|
||
def get_players_to_scrape(): | ||
asyncio.ensure_future(main()) | ||
asyncio.run(main()) |
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 |
---|---|---|
@@ -1,48 +1,38 @@ | ||
import asyncio | ||
import logging | ||
|
||
from apscheduler.executors.pool import ProcessPoolExecutor | ||
from apscheduler.schedulers.background import BackgroundScheduler | ||
|
||
from jobs.banbroadcaster.main import broadcast_bans | ||
from jobs.kafka.players.main import get_players_to_scrape | ||
from jobs.tipoff.main import tipoff_bots | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
executors = {"default": ProcessPoolExecutor()} | ||
|
||
scheduler = BackgroundScheduler(daemon=False, executors=executors) | ||
|
||
|
||
async def main(): | ||
logger.debug("Starting Main") | ||
scheduler.start() | ||
|
||
# Broadcast bans to #bot-graveyard on Discord, send total bans tweet, and send bans breakdowns tweets | ||
scheduler.add_job( | ||
broadcast_bans, | ||
"cron", | ||
hour=20, | ||
minute=5, | ||
misfire_grace_time=60, | ||
) | ||
|
||
# Send next tipoff batch to Jagex | ||
scheduler.add_job( | ||
tipoff_bots, | ||
"cron", | ||
hour=9, | ||
minute=45, | ||
misfire_grace_time=60, | ||
) | ||
|
||
get_players_to_scrape() | ||
# broadcast_bans() | ||
# tipoff_bots() | ||
while True: | ||
await asyncio.sleep(60) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) | ||
import argparse | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--run-broadcast", | ||
action="store_true", | ||
) | ||
parser.add_argument( | ||
"--run-tipoff", | ||
action="store_true", | ||
) | ||
parser.add_argument( | ||
"--run-kafka", | ||
action="store_true", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.run_broadcast: | ||
from jobs.banbroadcaster.main import broadcast_bans | ||
|
||
broadcast_bans() | ||
elif args.run_tipoff: | ||
from jobs.tipoff.main import tipoff_bots | ||
|
||
tipoff_bots() | ||
elif args.run_kafka: | ||
from jobs.kafka.players.main import get_players_to_scrape | ||
|
||
get_players_to_scrape() | ||
else: | ||
parser.print_help() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |