Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #495

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Solution #495

wants to merge 2 commits into from

Conversation

Le0n-K
Copy link

@Le0n-K Le0n-K commented Jan 9, 2025

{19A115FE-E093-4E79-8046-873C97D25729}

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Thank you for your hard work on this Pull Request! 😊 While your code is well-structured and mostly meets the task requirements, there are a couple of critical issues that need to be addressed before we can approve it:

  1. run_program Method Input: The run_program method in IOTService is currently being passed the result of run_parallel(wake_up, sleep), which is not a list of Message objects as expected. Please ensure that the method receives the correct type of input by restructuring the code to pass a list of Message objects.

  2. Awaiting Messages: The run_program method attempts to await a list of Message objects, which is not valid. You should iterate over the program list and await each message's processing individually. Consider using a loop to handle each message asynchronously.

Once these issues are resolved, your code should be ready for approval. Keep up the great work, and don't hesitate to reach out if you need further assistance! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

Comment on lines +43 to +45
async def run_program(self, program: list[Message]) -> None:
print("=====RUNNING PROGRAM======")
for msg in program:
self.send_msg(msg)
await program

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run_program method attempts to await a list of Message objects, which is not valid. You need to iterate over the program list and await each message's processing individually. Consider using a loop to handle each message asynchronously.


# run the programs
service.run_program(wake_up_program)
service.run_program(sleep_program)
await service.run_program(run_parallel(wake_up, sleep))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run_program method in IOTService expects a list of Message objects, but here it is being passed the result of run_parallel(wake_up, sleep), which is not a list of Message objects. You need to ensure that the run_program method receives the correct type of input. Consider restructuring the code to pass a list of Message objects instead.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]

If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your submission! 🎉 Your code demonstrates a solid understanding of asynchronous programming patterns in Python, particularly in the context of IoT device management. However, there are a couple of critical issues that need to be addressed to ensure the functionality aligns with the task requirements:

  1. run_program Method Input: The run_program method in the IOTService class is currently being passed the result of run_parallel(wake_up, sleep), which is not a list of Message objects as expected. Please restructure your code to ensure that the method receives the correct type of input.

  2. Awaiting Messages: The run_program method attempts to await a list of Message objects directly, which is not valid. You should iterate over the program list and await each message's processing individually. Consider using a loop to handle each message asynchronously.

These issues are crucial for the correct operation of your code, and addressing them will greatly enhance its robustness. Despite these points, your implementation is well-structured and shows promise. Keep up the good work, and make sure to incorporate the feedback to improve your code. This decision is made to help you move forward with your learning journey. 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +43 to +45
async def run_program(self, program: list[Message]) -> None:
print("=====RUNNING PROGRAM======")
for msg in program:
self.send_msg(msg)
await program

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run_program method attempts to await a list of Message objects, which is not valid. You should iterate over the program list and await each message's processing individually. Consider using a loop to handle each message asynchronously.

Comment on lines +46 to +47
# run the programs.
await service.run_program(run_parallel(wake_up, sleep))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run_program method is being passed the result of run_parallel(wake_up, sleep), which is not a list of Message objects as expected. Please ensure that the method receives the correct type of input by restructuring the code to pass a list of Message objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants