steps to create a DAG for airflow using a VM instance of Cloud through ssh terminal - google-cloud-platform

I am trying to create DAG using SSH terminal of a VM, but I am unable to get where I have write the DAG script I am using cloud and installed airflow through terminal only. Please guide me step-by-step, and Do I need to install any text editor? and how to link that editor to airflow?
I have used this tutorial and understood it but in there he is using a text editor. how to connect that to airflow as I am using Cloud?
from picture, I have created a dag_folder. but how to link that with AIRFLOW_HOME/dags and also I am unable to find PATH where that AIRFLOW_HOME/dags is there.

Related

Programmatically enable installed extensions in Vertex AI Managed Notebook instance

I am working in JupyterLab within a Managed Notebook instance, accessed through the Vertex AI workbench, as part of a Google Cloud Project. When the instance is created, there are a number of JupyterLab extensions that are installed by default. In the web GUI, one can click the puzzle piece icon and enable/disable all extensions with a single button click. I currently run a post-startup bash script to manage environments and module installations, and I would like to add to this script whatever commands would turn on the existing extensions. My understanding is that I can do this with
# Status of extensions
jupyter labextension list
# Enable/disable some extension
jupyter labextension enable extensionIdentifierHere
However, when I test the enable/disable command in an instance Terminal window, I receive, for example
[Errno 13] Permission denied: '/opt/conda/etc/jupyter/labconfig/page_config.json'
If I try to run this with sudo, I am asked for a password, but have no idea what that would be, given that I just built the environment and didn't set any password.
Any insights on how to set this up, what the command(s) may be, or how else to approach this, would be appreciated.
Potentially relevant:
Not able to install Jupyterlab extensions on GCP AI Platform Notebooks
Unable to sudo to Deep Learning Image
https://jupyterlab.readthedocs.io/en/stable/user/extensions.html#enabling-and-disabling-extensions
Edit 1:
Adding more detail in response to answers and comments (#gogasca, #kiranmathew). My goal is to use ipyleaft-based mapping, through the geemap and earthengine-api python modules, within the notebook. If I create a Managed Notebook instance (service account, Networks shared with me, Enable terminal, all other defaults), launch JupyterLab, open the Terminal from the Launcher, and then run a bash script that creates a venv virtual environment, exposes a custom kernel, and performs the installations, I can use geemap and ipywidgets to visualize and modify (e.g., widget sliders that change map properties) Google Earth Engine assets in a Notebook. If I try to replicate this using a Docker image, it seems to break the connection with ipyleaflet, such that when I start the instance and use a Notebook, I have access to the modules (they can be imported) but can't use ipyleaflet to do the visualization. I thought the issue was that I was not properly enabling the extensions, per the "Error displaying widget: model not found" error, addressed in this, this, this, this, etc. -- hence the title of my post. I tried using and modifying #TylerErickson 's Dockerfile that modifies a Google deep learning container and should handle all of this (here), but both the original and modifications break the ipyleaflet connection when booting the Managed Notebook instance from the Docker image.
Google Managed Notebooks do not support third-party JL extensions. Most of these extensions require a rebuild of the JupyterLab static assets bundle. This requires root access which our Managed Notebooks do not support.
Untangling this limitation would require a significant change to the permission and security model that Managed Notebooks provides. It would also have implications for the supportability of the product itself since a user could effectively break their Managed Notebook by installing something rogue.
I would suggest to use User Managed Notebooks.

GCP - run all cells of Jupyter Notebook without open browser and show logs to terminal

I started using VM instances in Google Cloud Platform to train deep learning. In a Linux machine what is the best way to start running cells of Jupyter Notebook without opening browser, just by command in terminal. Also I want to see all the output in terminal.
Yes this is possible and there are different ways of doing it;
One way is to use runipy. This will run all cells in a notebook.
The source code is here runipy
You can also save the output as html report or a notebook
You can install runipy using pip
$ pip3 install runipy
Another method is to use the python3 module nbconvert.
This would allow you to use a python interactive shell.
See the official Python documentation here Executing notebooks from the command line

Setting up the VM server on Google Cloud to run Jupyter notebook

I am following tutorial how to run Jupyter notebook on Google Cloud Platform (https://towardsdatascience.com/running-jupyter-notebook-in-google-cloud-platform-in-15-min-61e16da34d52). I am stuck at "Step 8: Set up the VM server". I have created Jupyter configuration file by typing jupyter notebook
--generate-config
in SSH session. After checking if it was created with
ls ~/.jupyter/jupyter_notebook_config.py
I get message No such file or directory. I really don't understand what is going on. I have never created VM before and I am a biologist (who tries to become a data scientist, lost in IT terminology), all I want to do is merge my dataframes on the cloud as I am lacking memory in my laptop. Can you please help me?

Using google cloud code editor

How to open files using code editor which is stored in compute engine created under google cloud? I can open for files stored using temporary cloud shell but not for the ones stored in compute engine.
Google Cloud Shell code editor can only open files that are stored in your Cloud Shell home directory (which, by the way, is not temporary; unlike Cloud Shell VMs that are recycled, home directory persists between sessions).
Cloud Shell code editor is based on the open source Orion editor. If you like that editor, you can install it on your GCE VM and connect to it directly.

AWS EC2 Windows SSH Help - Chmod 400 (RSA Key).pem Not Working

Thank you all who use their time to help others. Thank you in advance.
I am taking a class on EDX for Linux command line. I have attached the instructions I have followed to set up Red hat using Windows 10. But the SSH for isn't working it says that RSA Key not found. (Attachment didn't work)
I paste it here
"The recommended way to access your Red Hat Enterprise Linux cloud instance for this course is
to use Secure Shell (ssh​) to get an interactive shell on the system.
Step 1: Getting SSH
If you are using macOS or Linux: The OpenSSH command (ssh​) should already be installed on
your computer. Start a terminal program to get a shell, and proceed to the next step.
If you are using Microsoft Windows, you will need to get an SSH client as follows:
● Option 1: Download Git for Windows​ from https://git-scm.com/download/win and install
it using the default settings. When it is installed, right-click on your desktop (not an icon
or a file) and select Git Bash Here​ to open a Git Bash​ command prompt. An SSH client is
provided with Git Bash​ and you can continue with Step 2.
● Option 2: If you have the PuTTY client, which can be downloaded from
http://www.chiark.greenend.org.uk/~sgtatham/putty/, and you are familiar with that
tool, you can use that to connect to your instance. AWS provides a tutorial on this at
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html.
Step 2: Connecting to your instance with SSH
From the Amazon EC2 console, in the left-side menu under INSTANCES​, click Instances​ to
display a list of the instances you have running. This is probably just the one you set up for this
course. Select its checkbox and click Connect:"
Also, I have another PC I built running on Ubuntu. Can I use that PC with the RSA by logging into AWS account if there is no solution.
I have researched this question and I am stuck here trying to find a solution so I can start class.