How to make an auction command - discord.js

I actually want to make an auction command, it is pretty simple
Me: (prefix)bid 1 mil
Bot: zeyad bid 1 mil
Bot: going once
Some other user: (prefix)bid 2 mil
Bot: user bid 2 mil
Bot: going once
Bot: going twice
Bot: sold to user
So basically i want it to break the command which sends (going once and going twice) when someone else uses the same command. Please help and if i would appreciate if your share code

Related

constantUsersPerSecond in Gatling

I'm using Gatling to run loadtest.
I've put all the queries (3million queries in total) in a log file and load it into a feed
val feeder = tsv(logFileLocation).circular
val search =
feed(feeder)
.exec(
http("/")
.get("${params}")
.headers(sentHeaders)
).pause(1)
As for the simulation, I want 50 users concurrently and peak request at 50/seconds so I set up this way
setUp(myservicetest.inject(atOnceUsers(50))).throttle(
reachRps(50) in (40 minutes), jumpToRps(20), holdFor(20 minutes)).maxDuration(60 minutes).protocols(httpProtocol)
My assumption is these 50 users each loads the queries and starts from fisr to last queries. Because there are enough queries to execute, these 50 users will always stay on line for the whole duration (60 mins)
But when I ran it, I saw user1 runs query1, user2 runs query2, .. user50 runs query50. Every user just runs 1 query and then quit. So exactly 50 queries were executed in the loadtest and it finished quickly.
SO my question is, say I have 3 million queries in tsv(logFileLocation).circular and multiple users, will each user starts from query1 and try to execute all 3m queries. Or each user is scheduled to run part of the 3m queries and if enough time is allocated, at the end of the test all 3m queries are executed for just once?
Thanks
Disclaimer: Gatling's author here
The latter: "at the end of the test all 3m queries are executed for just once".
Each virtual user performs its scenario.
Injection profiles only controls when new virtual users are started.
If you want virtual users to perform more than one request, you have to include that in your scenario, eg with loops and pauses.
Those are Gatling basics, I recommend you have a look at the new Gatling Academy courses we've just launched.

Is there a dataset for products (UPC/EAN level) and their recycling information?

I am looking to do some analysis around plastic recycling and interested to know if there is any dataset that gives recycling information for products sold in US. For ex: a product with UPC/EAN number has a resin code of 1 (number written at the bottom of a plastic container). If you have any ideas on how to start creating it will be helpful as well. I understand there is something out there that gives information of a general 1 gallon milk container but I am looking at information on a brand/manufacturer level.
Thanks

Put an autosys job ON_ICE automatically depending on a calendar

I am working with a path of jobs on autosys that runs every night.
One of these jobs needs to run only on certain dates at the beginning of each month (usually the first 4 days but it can change depending on the business) so currently I'm putting said job ON_ICE or OFF_ICE manually and I'm looking to automate this.
I currently have 2 ideas but I'm stuck either way I choose.
Option 1 (the cleanest ?)
I would create a new job in between daily_job and monthly_job, called let's say calendar_check.
this job would start a batch on my app serveur, checking the database of my app where the calendar is, and depending of the database check sending back to autosys the good command to put the next job ON or OFF_ICE.
My batch looks like this
%My_SQLPATH% -S %My_SQL_SERVER% -d %My_SQL_DB -h-1 -W -Q "SQL Query that returns 1 or 0 depending on the calendar in my application" output.txt
set /P bEndMonth= < output.txt
echo %bEndMonth%
del output.txt
IF %bEndMonth% == 0 (start "somthing i don't know what 'sendevent -j ON_ICE -e monthly_job'") ELSE (start "somthing i don't know what 'sendevent -e OFF_ICE -j monthly_job'")
That last line is what I don't know how to write or if it's even possible to get back to my autosys server and use the sendevent command.
Little diagram for clarity
Option 2 (more messy but maybe easier)
I create 2 new jobs. One, on my path of jobs put monthly_job ON_ICE everyday.
Another one, not on my path of jobs, reads an autosys calendar and runs only on the calendar dates to put monthly_job OFF_ICE.
Downside is I must maintain another calender in autosys but it's minor.
But again I don't know the syntaxe for the jil to ask one job to put another job on or off ice.
Little diagram again for clarity
Any help is welcome or any other idea on how i could implement this.
Thank you !
For executing sendevent command in Autosys, the autosys cli package has to be installed, local variable to be declared and then login to the particular instance.
This could be verified by the Scheduling Admin/Middleware team if any.
If the days of the run at the start of the month is fixed, like first 5 days or first 5 working days, extended calendar can be considered.
Alternative way:
Since the condition to run/hold the job is based on the output of the SQL query from the database, we would use user defined exit code based on which the monthly job would trigger.
Step1: Make a script that would fetch the SQL query output and based on it we can define user exit codes.
LOGIN Database;
EXEC SQL Query;
IF %bEndMonth% == 0
THEN exit 0;
ELSE
exit 1;
Generally if the job exit code is > than 0, it would trigger an alarm for job failure, if required to suppress this, add the following attribute to this job:
max_exit_success:1
Now the job would be marked as success incase the exit is 0 or 1.
Considering the name of the job is Job_Cal_Check and is defined daily to run.
Step 2:
The monthly job/box would have no calendar and it would only trigger if the Job_Cal_Check job has exit 1. Add the following attribute
condition: exitcode (Job_Cal_Check) = 1
Edits: Fix Mis Run of successive jobs
Create an intermediate job to sleep for x seconds, calculate this time +-2 or 3 seconds taken for the monthly job to start after completion of the Job_Cal_Check.
The job flow would be:
Non Monthly Job
Previous Chain -> Job_Cal_Check -> Sleep_Job -> Followup_Jobs *(would wait only for Sleep_Job as the Monthly job would have completed status from the previous run)*
Monthly Job
Previous Chain -> Job_Cal_Check -> Sleep_Job + Monthly_Job *(both these jobs would we activated simultaneously)* -> Followup_Jobs *(would wait for both the jobs to complete)*
Job attributes as follows:
Sleep_Job:
condition: success (Job_Cal_Check)
Followup_Jobs
condition: success (Sleep_Job) AND success(Monthly_Job)
On days of Non monthly job,
Followup_Jobs would only wait for the Sleep_Job to complete.
On days of Monthly job,
Followup_Jobs would first wait for the Sleep_Job to complete by this time the Montlhy_Job would have Activated/In Running/Completed and upon completion, the job flow would continue.
Hope this helps, if anything more required do ask.

create a new file from a string of text

I need to create a series of files with the file name of a line of text in a text document. I am on a mac and don't know about scripting. Is there a simple utility or a Terminal command where I can drag and drop in the file with the text in it and it would make the new files in the same directory?
The text file would say:
Week 1 Session 1
Week 1 Session 2
Week 1 Session 3
Week 2 Session 1
Week 2 Session 2
Week 2 Session 3
Week 3 Session 1
Week 3 Session 2
Week 3 Session 3
Week 4 Session 1
Week 4 Session 2
Week 4 Session 3
And so on for 35 weeks, with 'Week' starting a new line. This is something I would have to make periodically.
Having searched for an answer, I can see plenty of file names to a text file but not much the other way.
I apologise if this appears too simplistic but I would appreciate any help with this.
Thank you for the advice but I did find out how to do it.
On the mac you open a Terminal window and write 'touch' then the file name(s). If there is a gap in the file name, you put it in double inverted commas like this: "file 1.txt" then a space and more inverted commas if you want a second file such as
"file 1.txt" "file 2.txt"
I used Numbers (like Excel) to make all the names and pasted it in.
And that way it all worked very quickly. Low tech I am sure, but quick and useful.
Hopefully that answer will be useful to someone like me in the future.

How to identify reason of OverQuotaError when sending emails?

I send emails with cron job and task queue usage. The job is executed every 15 minutes and the queue used has the following setup:
- name: send-emails
rate: 1/m
max_concurrent_requests: 1
retry_parameters:
task_retry_limit: 0
But quite often apiproxy_errors.OverQuotaError exception happens. I am checking Quota Details and see that I am still within the daily quota (Recipients Emailed, Attachment Data Sent etc.), and I believe I couldn't be over maximum per minute limit, since the the rate I use is just 1 task per minute (i.e. send no more than 1 mail per minute).
Where am I wrong and what should I check?
How many emails are you sending? You have not set a bucket-size, so it defaults to 5. Your rate sets how often the bucket is replenished. So, with your current configuration, you can send 5 emails every minute. That means if you are sending more than 75 emails to the queue every 15 minutes, the queue will fill up, and eventually go over quota.
I have not tried this myself, but when you catch the apiproxy_errors.OverQuotaError exception, does the message contain any detail as to why it is over quota/which quota has been exceeded?
try:
send_mail_here
except apiproxy_errors.OverQuotaError, message:
logging.error(message)

Resources