Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

You can get the version of CentOS using the following command.

:::bash
rpm -q centos-release

This trick can be used to get the version of the CentOS distribution on a Spark cluster. Basically, you run this command in the driver or workers to print the versions and then parse the log of the Spark application.

:::python
#!/usr/bin/env python3
import subprocess as sp
from pyspark.sql import SparkSession

spark = SparkSession.builder.appName("CentOS_Version") \
    .enableHiveSupport().getOrCreate()
sp.run("rpm -q centos-release", shell=True, check=True)