头图

welfare activities
The 2022 second season hot summer welfare activities officially kicked off. From now until the evening of July 25th, as long as you participate in the User Group welfare activities and submit the code learning experience development and deployment program, you can directly get [Naixue's Tea Coupon]
A cup of User Group after a tired afternoon
Nayuki's tea for everyone

01. Participation method

Anyone with an AWS account can participate, and everyone can participate once.

02. Game rules

The following calculations are implemented by writing Python code.

A laboratory has accumulated n computing jobs to be run. In order to complete these jobs, the laboratory rents a server for consecutive free units of machine time.

We use an array times of length n to represent the processing time required for each job, where times[i] represents the processing time required for the ith job. The lab wants to use these machines to run enough jobs.
Given the processing time arrays times and free, please calculate and return the maximum number of assignments that the lab can complete with free units.

Notice:
Jobs can be executed in any order.

A single job needs to be completed continuously, and the job execution cannot be interrupted.

03. Submitting requirements

Please submit a single Python source file to implement the above problem solving.

04. Code execution environment

Additional libraries available for Python 3.9 / 128MB memory: AWS SDK for Python
For specific version information, please refer to the documentation (you need to copy the link to open it in the browser)
( https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html )

05. Python code requirements

The code must include the following entry function, which takes the s3 file path as a parameter and returns the calculation result required to be returned above.

The input file content format is,

 free_number\ttimes[0],times[1],times[2],...,times[n]

def handler(event, context):   inputfile = event['url']   
# input 是目标S3文件,格式类似 s3://mybucket-name/myfiles/inputfile1   
result = yourmethod_find_maximum_number_of_jobs(inputfile)   
return result

Example:
Enter event:
{
"url": "s3://mybucket-name/myfiles/inputfile1"
}
s3://mybucket-name/myfiles/inputfile1
The content of the file is:
20\t3,8,8,10
Enter as above
times = [3, 8, 8, 10], free = 20
output: 3
Explanation: The lab can complete the tasks with subscripts 0, 1, 2, and the total time is 3 + 8 + 8 = 19

06. Submit code steps

Step 1 <br>Register an Amazon cloud technology account ( https://s.awsevents.cn/1cg8t4 Copy to browser to open or click to read the original text to jump), and log in to the console. Existing accounts can be used.
(Click the picture to enlarge to see the specific operation)

Step 2 <br>Create a new API
(Click the picture to enlarge to see the specific operation)

Please note that the Lambda function should fill in the following: arn:aws:lambda:ap-southeast-1:324908031092:function:contest-checker-checker31A6B3BF-td0E0mBsHMyY

Note: The function string does not contain spaces. So far you have successfully created the API~

Step 3 <br>Submit the completed program to the User Group smart assistant to judge and redeem the reward.
Submit the following HTTP form-data form to the API interface you deployed earlier.

 "eventId": "20220701", 
# 必填,本期活动代码为 20220701,不可修改
"nickname": 您的称呼, 
# 必填,您的昵称"result": 挑战的代码文件
# 必填,实现本期任务的 Python 代码文件

Example of step 3:
1. Use the programmer's favorite command line tool to submit the example curl -F eventId=20220701 -F result=@/home/myname/aws-user-group-challenge.py -F nickname=Peter Pan https://.execute -api.ap-northeast-1.amazonaws.com
2. Submit an example using Postman, a graphical HTTP request tool

Q1 : Are there benefits to participating in the event?
A: Of course there is! Who made User Group the most favorite fan developer! For every developer who has successfully run this event, the system will directly distribute [Naixue's Tea Coupon] to you, and in a tired afternoon, have a cup of Nayuki's tea brought to you by the Amazon Cloud Technology User Group!

Q2 : After submitting the participating works through HTTP, what else do I need to do?
A: It takes no more than 30 seconds to wait. If the submission is correct, you will receive the tea code of the electronic Nayuki immediately; if it is wrong, the system will remind you to test it once.

And remember to pay attention to the public account [User Group], otherwise don't blame Xiao U for not reminding you to receive more event benefits! See below for benefits details!

Q3 : Are there other benefits?
A: Must have! In addition, we will select the top 10 participants and send a beautiful peripheral to the Amazon Cloud Technology User Group!

Ranking method: On the premise of successful operation, the ranking is based on the completion time. The list will be sent out in a follow-up tweet. You must continue to pay attention to the official account [User Group] and reply to the receipt information so that you can receive the benefits as soon as possible!

Q4: Are the series of events related each time?
A: There must be! Not only that, but there are bonuses too!

This series of welfare activities is a multi-issue serial mode. If the developers who participated in the welfare activities at the beginning of the new year, we will record the participation status for everyone, and select the [Annual Talent] in the year-end award, and send the annual mysterious gift!

Ha ha! Don't worry if you haven't caught up with the activities at the beginning of the year, from now on, get involved! Scan the code to join the group! Right now, don't miss a series of User Group welfare activities! Let's count the number of participations together! You are the winner of the year!


亚马逊云开发者
2.9k 声望9.6k 粉丝

亚马逊云开发者社区是面向开发者交流与互动的平台。在这里,你可以分享和获取有关云计算、人工智能、IoT、区块链等相关技术和前沿知识,也可以与同行或爱好者们交流探讨,共同成长。