oracle-devrel / leagueoflegends-optimizer

League of Legends Optimizer - Learn Artificial Intelligence with Gaming
Universal Permissive License v1.0
106 stars 27 forks source link

Issue when running the script #35

Open Gnjenga opened 7 months ago

Gnjenga commented 7 months ago

I am currently following the legaue of legends machine learning with OCI workshop and on the third task when running ./start.sh I get the folowing error on datascience.tf file. Kindly assist

│ Error: Invalid index │ │ on datascience.tf line 24, in resource "oci_datascience_notebook_session" "lol_notebook_session": │ 24: shape = data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes[0].name │ ├──────────────── │ │ data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes is empty list of object │ │ The given key does not identify an element in this collection value: the collection has no elements. ╵ ╷ │ Error: Invalid index │ │ on datascience.tf line 44, in output "ds_notebook_session_shape": │ 44: value = data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes[0].name │ ├──────────────── │ │ data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes is empty list of object │ │ The given key does not identify an element in this collection value: the collection has no elements.

And here is how my datascience.tf looks like:

`resource "oci_datascience_project" "lol_project" { compartment_id = var.compartment_ocid

description = "League of Legends Project" display_name = "LoL Project ${random_string.deploy_id.result}"

depends_on = [ oci_core_subnet.privatesubnet ] }

FIXME bad hack to avoid: The specified subnet is not accessible. Select a different subnet.

resource "time_sleep" "wait_a_bit" { create_duration = "120s" }

resource "oci_datascience_notebook_session" "lol_notebook_session" { compartment_id = var.compartment_ocid project_id = oci_datascience_project.lol_project.id

display_name = "League of Legends Notebook Session"

notebook_session_config_details { shape = data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes[0].name

subnet_id = oci_core_subnet.privatesubnet.id

}

depends_on = [ time_sleep.wait_a_bit ]

}

data "oci_datascience_notebook_session_shapes" "ds_shapes" { compartment_id = var.compartment_ocid filter { name = "core_count" values = [var.desired_number_cpus] } }

output "ds_notebook_session_shape" { value = data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes[0].name }

output "ds_notebook_session" { value = oci_datascience_notebook_session.lol_notebook_session.notebook_session_url }`

mgunnin commented 7 months ago

Same error. Guessing it doesnt work anymore in oracle.

mgunnin commented 7 months ago

@vmleon

mgunnin commented 7 months ago

Here's a fix that modifies the datascience.tf file to handle empty data source results gracefully. It resolved the error for me

resource "oci_datascience_project" "lol_project" {
  compartment_id = var.compartment_ocid

  description  = "League of Legends Project"
  display_name = "LoL Project ${random_string.deploy_id.result}"

  depends_on = [
    oci_core_subnet.privatesubnet
  ]
}

# FIXME bad hack to avoid: The specified subnet is not accessible. Select a different subnet.
resource "time_sleep" "wait_a_bit" {
  create_duration = "120s"
}

resource "oci_datascience_notebook_session" "lol_notebook_session" {
  compartment_id = var.compartment_ocid
  project_id     = oci_datascience_project.lol_project.id

  display_name = "League of Legends Notebook Session"

  notebook_session_config_details {
    shape = length(data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes) > 0 ? data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes[0].name : "Default_Shape"

    subnet_id = oci_core_subnet.privatesubnet.id
  }

  depends_on = [
    time_sleep.wait_a_bit
  ]

}

data "oci_datascience_notebook_session_shapes" "ds_shapes" {
  compartment_id = var.compartment_ocid
  filter {
    name   = "core_count"
    values = [var.desired_number_cpus]
  }
}

output "ds_notebook_session_shape" {
  value = length(data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes) > 0 ? data.oci_datascience_notebook_session_shapes.ds_shapes.notebook_session_shapes[0].name : "Default_Shape"
}

output "ds_notebook_session" {
  value = oci_datascience_notebook_session.lol_notebook_session.notebook_session_url
}
mgunnin commented 7 months ago

DIsregard.. Still hitting other errors. Not familiar enough with Oracle or Terraform to debug further. Hopefully the code owners can suggest a fix.

jasperan commented 4 months ago

Hey @mgunnin thanks for the comments - I've taken a look and this is an issue some people are getting. May I ask what your OCI account type is (Free Tier / Always Free / Paid Credits)? Looks like this issue is happening to people in the Always Free tier most times.

mgunnin commented 4 months ago

Hey @mgunnin thanks for the comments - I've taken a look and this is an issue some people are getting. May I ask what your OCI account type is (Free Tier / Always Free / Paid Credits)? Looks like this issue is happening to people in the Always Free tier most times.

Yes, it was the free tier since I was following the guide to setup a new account with credits. It's expired by now though and I can't tell you how many hours I spent trying to get around it. Definitely learned a lot about OCI at least, hah.

But yeah, I'm pretty sure its definitely related to the account type.

jasperan commented 4 months ago

Hey @mgunnin thanks for the comments - I've taken a look and this is an issue some people are getting. May I ask what your OCI account type is (Free Tier / Always Free / Paid Credits)? Looks like this issue is happening to people in the Always Free tier most times.

Yes, it was the free tier since I was following the guide to setup a new account with credits. It's expired by now though and I can't tell you how many hours I spent trying to get around it. Definitely learned a lot about OCI at least, hah.

But yeah, I'm pretty sure its definitely related to the account type.

Well, I hope you learned about OCI at least! You could theoretically run the code in src/ in your local PC to create those models and test them. Did you work on anything you found on this repo? (Just curious)

Thanks.

mgunnin commented 4 months ago

Hey @mgunnin thanks for the comments - I've taken a look and this is an issue some people are getting. May I ask what your OCI account type is (Free Tier / Always Free / Paid Credits)? Looks like this issue is happening to people in the Always Free tier most times.

Yes, it was the free tier since I was following the guide to setup a new account with credits. It's expired by now though and I can't tell you how many hours I spent trying to get around it. Definitely learned a lot about OCI at least, hah. But yeah, I'm pretty sure its definitely related to the account type.

Well, I hope you learned about OCI at least! You could theoretically run the code in src/ in your local PC to create those models and test them. Did you work on anything you found on this repo? (Just curious)

Thanks.

Yeah, I'm happy to walk you through it. We built something similar before Riot had a real-time API at Esports One using Computer Vision and OCR. We fed the data we could capture (obviously not as robust as what you get from the source) into a live odds and predictions algorithm and analytics dashboard for play-by-play commentators.

I'm now building something related to virtual AI athletes, so I was looking around at different projects when I stumbled upon this. I've already been using a good bit of the code to pull in historical data of the top players across all the regions (after a few changes). So, that part of the project works excellently (once you remove the OCI stuff). But I couldn't get the real-time and predictive code working, albeit I didn't spend much time on it after slamming my head into my desk for a week trying to get OCI running.

I did go through a number of your repos a few weeks ago and got myself into a rabbit hole for a day or so, lol. You're working on some really neat stuff. I am happy to share notes and riff on some ideas sometimes. My Twitter is MatthewGunnin. Feel free to give me a shout.

jasperan commented 4 months ago

Thanks for the kind words, I do appreciate it! I hope you enjoyed part of the code, I always get excited when people look at my projects and invest some time into reusing my code. <3

mgunnin commented 4 months ago

Thanks for the kind words, I do appreciate it! I hope you enjoyed part of the code, I always get excited when people look at my projects and invest some time into reusing my code. <3

You bet!

Just to confirm though, the OCI integrations won't work on the free trial account, even if it has the initial $300 credits, correct? If so, is there any way around it? I've never been a user of OCI/Oracle Cloud, and if I could have gotten this working it would have obviously been a big reason to stick around. Just saying ;)

jasperan commented 4 months ago

Thanks for the kind words, I do appreciate it! I hope you enjoyed part of the code, I always get excited when people look at my projects and invest some time into reusing my code. <3

You bet!

Just to confirm though, the OCI integrations won't work on the free trial account, even if it has the initial $300 credits, correct? If so, is there any way around it? I've never been a user of OCI/Oracle Cloud, and if I could have gotten this working it would have obviously been a big reason to stick around. Just saying ;)

Yes, they can work on the OCI Free Trial account, but some of these regions (the most popular ones) are out of host capacity for some shapes that we are using in compute here. If you register into a region that's not widely used, you will be able to create the resources with no problems.

Unfortunately there's no way to check the % availability for each region on compute resources, but from experience I could tell you that Ashburn, Phoenix, Frankfurt, London are most likely out of host capacity for Free Tier. The newer regions have a higher chance of working out with Free Tier