josephmachado / beginner_de_project

Beginner data engineering project - batch edition
https://www.startdataengineering.com/post/data-engineering-project-for-beginners-batch-edition/
MIT License
464 stars 136 forks source link

Stuck at "attaching to airflow_init_1" #7

Closed rab241 closed 3 years ago

rab241 commented 3 years ago

Thank you for the help! I figured out on my own some issues and also cant find updated instructions on setting up the environments. Here is a screenshot of my issue. I also am getting that the username and password for airflow is wrong. I also dont understand where and when to enter that. I would appreciate the help!

Screen Shot 2021-06-22 at 8 07 09 PM
josephmachado commented 3 years ago

Hi @rab241 It looks like the postgres container is not running. Can you

  1. tear down infra with ./tear_down_infra.sh {your-bucket-name} and then
  2. Increase docker size as shown here https://github.com/apache/airflow/issues/14365#issuecomment-785267821, restart docker and ./setup_infra.sh {your-bucket-name}

If the issue still exists can you copy paste the logs ?

rab241 commented 3 years ago

Thank you that seemed to work! However it is still stuck at attaching to airflow-init_1 and nothing seems to happen

Screen Shot 2021-06-22 at 11 25 16 PM
josephmachado commented 3 years ago

@rab241 It takes a few min(1-2), can you lmk how long you waited ?

rab241 commented 3 years ago

I waited around 10 minutes

Get Outlook for iOShttps://aka.ms/o0ukef


From: startdataengineering @.> Sent: Wednesday, June 23, 2021 6:47:26 AM To: josephmachado/beginner_de_project @.> Cc: Biaz, Rim A @.>; Mention @.> Subject: Re: [josephmachado/beginner_de_project] Stuck at "attaching to airflow_init_1" (#7)

@rab241https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frab241&data=04%7C01%7Crab241%40pitt.edu%7Cb8a3087d35a74180380708d9363cac83%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637600456484817577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=j3UWbPk828Vig2tt9Xnr%2FDq6luKLTd%2FaGUMOAxKDk0U%3D&reserved=0 It takes a few min(1-2), can you lmk how long you waited ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjosephmachado%2Fbeginner_de_project%2Fissues%2F7%23issuecomment-866767535&data=04%7C01%7Crab241%40pitt.edu%7Cb8a3087d35a74180380708d9363cac83%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637600456484817577%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=r61bix3fJdrMqjLUZA1UFhCFT7%2F8a5AckfOyHYAcgAI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAUBEAP5QOULC55GVALBLE3TTUHCU5ANCNFSM47EWFZUQ&data=04%7C01%7Crab241%40pitt.edu%7Cb8a3087d35a74180380708d9363cac83%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637600456484827578%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lMiED7dHok3%2B2uA8D19%2FDl%2BfQTviVGfAoNy5fxxegsQ%3D&reserved=0.

dennisgsmith commented 3 years ago

@rab241 I had this same issue when rerunning ./setup_infra.sh. Clearing the Docker cache and rerunning the script solved it for me: docker system prune --volumes

Alternatively, maybe adding the --force-recreate flag to the docker compose command will fix this but I haven't tried it out yet.

dennisgsmith commented 3 years ago

@josephmachado I was able to recreate the issue by running the ./setup_infra.sh script, canceling it after the image builds, and then re-running the script. Modifying docker compose up airflow-init --force-recreate with this flag fixed the issue without having to manually clear my docker cache. If this solves the problem, I can submit a PR if you'd like.

rab241 commented 3 years ago

Hi, thanks for all the help! However, this is the issue that comes up when I ran the airflow recreate

Screen Shot 2021-06-23 at 9 08 00 AM
josephmachado commented 3 years ago

Thank you. That would be amazing @dennisgsmith

josephmachado commented 3 years ago

@rab241 Think the Postgres container is still running(hence the 5432 port in use already), can you restart the docker container and try again using this https://github.com/josephmachado/beginner_de_project/issues/7#issuecomment-866790709

rab241 commented 3 years ago

I had done that and redid it and the same 5432 port in use is still the error

dennisgsmith commented 3 years ago

@rab241 If you execute lsof -n -i:5432 | grep LISTEN you can see whatever is taking up that port. If you have a system version of Postgres using the port will need to shut it down.

rab241 commented 3 years ago

nothing shows up when I run that command

dennisgsmith commented 3 years ago

@rab241 What if you run as sudo? sudo lsof -i :5432

If there is anything running, you should be able to kill it by specifying the PID sudo kill -9 PID dwyl/learn-postgresql#60 (comment)

You could also try killing it by specifying by postgres user without a PID sudo pkill -u postgres PostgresApp/PostgresApp#197 (comment)

josephmachado commented 3 years ago

@rab241 could you run docker ps and paste the output here please.

rab241 commented 3 years ago
Screen Shot 2021-06-23 at 9 59 28 AM
rab241 commented 3 years ago

So while I was setting up again, it got stuck again at attaching to airflow. I went into the docker and manually ran the different containers which started to run the airflow init and then reached to points where my s3 bucket needed more permissions. I created the permissions and now it is looping on this error: An error occurred (ClusterNotFound) when calling the DescribeClusters operation: Cluster sde-batch-de-project not found.

it keeps sleeping for 60 seconds and checking

rab241 commented 3 years ago

I cancelled and tore down the infrastructure and this error occurred: An error occurred (NoSuchEntity) when calling the DetachRolePolicy operation: The role with name sde-spectrum-redshift cannot be found. Dissociating AWSGlueConsoleFullAccess policy from sde-spectrum-redshift role

rab241 commented 3 years ago

with manually running airflow-init, and postgres this happens before what I just mentioned

Screen Shot 2021-06-23 at 10 46 19 AM Screen Shot 2021-06-23 at 10 46 42 AM
rab241 commented 3 years ago

It successfully set up containers and airflow after completely trying again

Screen Shot 2021-06-23 at 10 55 12 AM

Then I ran this and the airflow password worked but then I dont know what to do now pgcli -h localhost -p 5432 -U airflow

Screen Shot 2021-06-23 at 10 59 23 AM
rab241 commented 3 years ago

I realized it is working now lol! Thanks for all your help!