music.cloud

Module contents

Infrastucture code include handing off tasks to Cloud Tasks or Cloud Functions

music.cloud.offload_or_run_user_playlist(username: str, playlist_name: str)
music.cloud.queue_run_user_playlist(username: str, playlist_name: str)

cloud.function

music.cloud.function.run_user_playlist_function(username: str, playlist_name: str)None

Queue serverless playlist update for user

Parameters
  • username (str) – Subject username

  • playlist_name (str) – Subject tag ID

music.cloud.function.update_tag(username: str, tag_id: str)None

Queue serverless tag update for user

Parameters
  • username (str) – Subject username

  • tag_id (str) – Subject tag ID

cloud.tasks

Functions for creating GCP Cloud Tasks for long running operatings

music.cloud.tasks.refresh_all_user_playlist_stats()

“Create user playlist stats refresh task for all users

music.cloud.tasks.refresh_playlist_task(username: str, playlist_name: str, delay: int = 0)

Create user playlist stats refresh tasks

Parameters
  • username (str) – Subject user’s username

  • playlist_name (str) – Subject playlist name

  • delay (int, optional) – Seconds to delay execution by. Defaults to 0.

music.cloud.tasks.refresh_user_playlist_stats(username: str)

Refresh all playlist stats for given user, environment dependent

Parameters

username (str) – Subject user’s username

music.cloud.tasks.refresh_user_stats_task(username: str, delay: int = 0)

Create user playlist stats refresh task

Parameters
  • username (str) – Subject user’s username

  • delay (int, optional) – Seconds to delay execution by. Defaults to 0.

music.cloud.tasks.run_user_playlist_task(username: str, playlist_name: str, delay: int = 0)

Create tasks for a users given playlist

Parameters
  • username (str) – Subject user’s username

  • playlist_name (str) – Subject playlist name

  • delay (int, optional) – Seconds to delay execution by. Defaults to 0.

music.cloud.tasks.update_all_user_playlists()

Create user playlist refresh task for all users

music.cloud.tasks.update_all_user_tags()

Create user tag refresh task for all users

music.cloud.tasks.update_playlists(username: str)

Refresh all playlists for given user, environment dependent

Parameters

username (str) – Subject user’s username