<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by VIKASH GUPTA on Medium]]></title>
        <description><![CDATA[Stories by VIKASH GUPTA on Medium]]></description>
        <link>https://medium.com/@vksgupta44?source=rss-2d77bdb7de9c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OJhpSsVyR2t_Dsl3zf7uSg.jpeg</url>
            <title>Stories by VIKASH GUPTA on Medium</title>
            <link>https://medium.com/@vksgupta44?source=rss-2d77bdb7de9c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:47:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vksgupta44/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Celery for Python (Part-1)]]></title>
            <link>https://medium.com/@vksgupta44/understanding-celery-for-python-part-1-38d987fc56da?source=rss-2d77bdb7de9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/38d987fc56da</guid>
            <dc:creator><![CDATA[VIKASH GUPTA]]></dc:creator>
            <pubDate>Sat, 11 Jan 2025 13:57:06 GMT</pubDate>
            <atom:updated>2025-01-17T07:30:55.466Z</atom:updated>
            <content:encoded><![CDATA[<p>Celery is an <a href="https://github.com/celery/celery/tree/main">open-source</a> task queue system for Python that allows for asynchronous processing of tasks. It’s used to offload time-consuming or resource-intensive tasks to background workers</p><p><strong>Task Queues</strong></p><ul><li>Task queues manage background work that must be executed outside the usual HTTP request-response cycle</li><li>Celery communicates via messages, usually using a broker to mediate between clients and workers</li><li>To initiate a task the client adds a message to the queue, the broker then delivers that message to a worker</li><li>A Celery system can consist of multiple workers and brokers, giving way to high availability and horizontal scaling</li></ul><p><strong>Celery Arch</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/0*A1bqopBEY-uMNHNE.jpg" /></figure><p><strong>Broker &amp; Backend Overview</strong></p><p>Celery supports several message transport alternatives [<a href="https://docs.celeryq.dev/en/stable/getting-started/backends-and-brokers/index.html">Ref</a>].</p><ul><li>RabbitMQ — It connects through AMQP protocol</li><li>Redis — It connects through Redis protocol</li><li>AWS SQS — It connects through SQS protocol</li><li>Zookeeper (Experimental)</li></ul><p>Backend is for storing Celery task result [<a href="https://docs.celeryq.dev/en/stable/userguide/configuration.html#conf-rpc-result-backend">Ref</a>]</p><ul><li>RabbitMQ — It connects through rpc protocol</li><li>Redis — It connects through same Redis protocol</li><li>SQLAlchemy — It connects through particular DB server based protocol</li></ul><p><strong>Note:</strong></p><ul><li>Based on my experience RabbitMQ as a broker very reliable and stable, Redis at some extent is stable and reliable but not for high scale</li><li>For backend Redis is reliable and consistent at large scale</li></ul><p><strong>Start to write first Celery tasks</strong></p><p>A sample program to understand the Celery, let’s create the file <em>init_celery.py </em>to use celery config and tasks management:</p><pre>from celery import Celery<br>app = Celery(&#39;tasks&#39;, broker=&#39;amqp://guest:guest@localhost//&#39;)<br><br>app.autodiscover_tasks([&quot;tasks&quot;]) # all tasks to register to Celery, any change required to re-start Celery</pre><p>Create <em>tasks.py:</em></p><pre>@app.task(name=&quot;add_numbers&quot;)<br>def add(x, y):<br>  return x + y</pre><p><strong>Running Celery workers</strong></p><p>Prerequisite:</p><ul><li>Install python3.10 or above version (Ubuntu default version)</li><li>Install Celery 5 or above version (using pip)</li><li>RabbitMQ server</li><li>Install <em>amqp</em> module using pip for connecting RabbitMQ server</li></ul><p>Command to run Celery workers</p><ul><li><em>celery -A &lt;celery-config.py&gt; worker</em></li><li>For our example:<em> celery -A init_celery worker</em></li><li>Help command for celery worker: <em>celery worker — help</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LoO7bZ4_7w7acVR9EQkHHQ.png" /><figcaption>Celery worker start logs</figcaption></figure><p>You can see in above screenshot, Celery transport info and task list, for our example task-name is <em>add_numbers</em></p><p><strong>Calling Celery tasks</strong></p><p>Create the file, <em>pub_celery_tasks.py</em></p><pre>from tasks import add<br>printf(add.delay(4, 4)) # you can use other wrappers like apply_async for more control</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87Y5p-jqY7qkkLoiBCUWqA.png" /><figcaption>Celery task received logs</figcaption></figure><p><strong>Advance usage of Celery</strong></p><p>You can use Celery to design Work-flows, that called Canvas [<a href="https://docs.celeryq.dev/en/latest/userguide/canvas.html">Ref</a>]</p><ul><li>Groups</li><li>Chains</li><li>Chords</li><li>Map &amp; Starmap</li><li>Chunks</li></ul><p>Alternative tools for designing work-flows for Python</p><ul><li><a href="https://airflow.apache.org/">Airflow</a></li><li><a href="https://github.com/spotify/luigi">Luigi</a></li></ul><p><strong>What else with Celery</strong></p><ul><li>You can also Schedule task with Celery</li><li>You can also trigger Celery task using other programming languages based on Broker compatibility with the language</li><li>You can invoke Luigi tasks from Celery tasks</li><li>Now Airflow also supports Celery tasks</li><li>Many customs things are available related to tasks like late ack, expire, retry, specific queue, ttl of task, etc.</li></ul><p><strong>Reference</strong></p><p>Reference you can use to set up and start the Celery:</p><ul><li>Official doc <a href="https://docs.celeryq.dev/en/stable/getting-started/introduction.html#celery-is">Celery 5.4.0</a> you can refer for more details</li><li>A <a href="https://www.youtube.com/watch?v=68QWZU_gCDA">4 Minute Intro to Celery</a> is a short introductory task queue screen-cast</li><li>Tech blog to understand <a href="https://www.vintasoftware.com/blog/celery-overview-archtecture-and-how-it-works">Celery architecture</a></li><li>Rabbitmq <a href="https://gist.github.com/vidur-88/6bd628190f16bfd3f1c0937d8f518b46">docker-compose.yml</a> gist =&gt; <em>docker-compose -f docker-compose.yml up -d</em></li><li>Docker compose <a href="https://docs.docker.com/compose/install/">installation guide</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38d987fc56da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When to Buy the stocks and when to Sell]]></title>
            <link>https://medium.com/@vksgupta44/when-to-buy-the-stocks-and-when-to-sell-2470b62a380?source=rss-2d77bdb7de9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2470b62a380</guid>
            <category><![CDATA[investing]]></category>
            <dc:creator><![CDATA[VIKASH GUPTA]]></dc:creator>
            <pubDate>Sun, 22 Oct 2017 08:09:00 GMT</pubDate>
            <atom:updated>2017-10-22T11:50:28.116Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>First study the fundamentals of the company</strong></h3><p>Balance sheet should be clear. How would you measure balance sheet is clear or not? Following is the way to see balance sheet (only for manufacturing companies not for IT, Banking companies)</p><p>First you should see equity should be same for last year or increase by some small number.</p><p>If equity goes down it is good sign it means company doing good. This can be done by if company buyback their share. It reflects company is very confident on their business.</p><p>Why we are preferring less equity share because less equity means less people to share profits.</p><p>Check reserve and surplus are constant or continuously increasing. It means company is putting profit in its own business for expanding.</p><p>Debts continuously decreasing or not greater than shareholder values (equity + reserve surplus)</p><h3><strong>Profit and loss statement reading:</strong></h3><p>Net sales should be constant or increasing is good indication that company is performing well.</p><p>Expenses should be decreasing time to time is showing company’s management is good for producing product.</p><p>If Interest expense is going down is also good indication that company is performing well.</p><h3><strong>Ratio statement reading:</strong></h3><p>Profit/net-worth ratio should be good or increasing which makes you comfortable to invest in the company.</p><p>Profit to net-worth ratio is constant and reserve and surplus is increasing it means company is putting money into the company. That is also good indication. For reserve and surplus check balance sheet section.</p><p>Debt to equity ratio should be less than one. It means company profit is more than what company is paying interest on debt, less value is good.</p><p>Above three statement (balance sheet, profit and loss, ratios) of the company will help you to understand the fundamentals. These things help you to pick the good stocks to invest. Now, need to find good time to invest in the stocks. It means when you should buy and sell the stocks.</p><h3>Index PE (Price to earning per share) ratio will help to buy the stock and sell the stock:</h3><p>First what is index, index is the group of stocks. Like Nifty, Sensex, S&amp;P500, etc. Index indicates values not price of the share. Its value calculate in following way:</p><ol><li>First calculate m-cap (market capitalization) of the participating companies.</li></ol><blockquote>Total m-cap = sum(issued shares(i) * share price(i)),</blockquote><blockquote>where i is ith company</blockquote><blockquote>Issued shares you can get from company’s annual report</blockquote><p>2. At first time when index formed exchanges give base value and then following days will calculate index value based on change in <em>m-cap</em> of participating companies.</p><h3>How PE ratio will help?</h3><p>Following is the example for NIFTY-50 (It is index of NSE)</p><ul><li>First Get historical PE ratio of Nifty from NSE.</li><li>Calculate average value of PE ratio</li><li>Calculate upper band and lower band (on your concerns)</li><li>Upper band means a value from where market goes down after some days or months and lower band is the value from where market goes up after some days or months.</li><li>For NIFTY based on historical data upper band is 60 and lower band is 22.</li></ul><p><strong>So, ideal time to buy when index PE ratio touch your lower band and sell when index touch you upper band. Simple but not very effective, buy when PR ratio goes down to average value and sell goes above the average value.</strong></p><p><strong>In </strong>next version you will get how to read assets part in balance sheet (in this I mentioned only liabilities part), calculation of upper band and lower band of NIFTY PE value with historical data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2470b62a380" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is sharing photos/quotes of martyr in attack of Pathankot right way give tribute to them]]></title>
            <link>https://medium.com/@vksgupta44/is-sharing-photos-quotes-of-martyr-in-attack-of-pathankot-right-way-give-tribute-to-them-b30e6c4cdc92?source=rss-2d77bdb7de9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b30e6c4cdc92</guid>
            <category><![CDATA[social]]></category>
            <dc:creator><![CDATA[VIKASH GUPTA]]></dc:creator>
            <pubDate>Wed, 06 Jan 2016 08:42:15 GMT</pubDate>
            <atom:updated>2016-01-06T08:46:20.689Z</atom:updated>
            <content:encoded><![CDATA[<p>Attack on Pathankot makes many people in deep sorrow. Lot’s of people sharing their photo or Quotes based on them on FB, Twitter, Instagram and other online platforms. Is this the right way to give tribute to martyr in attack of Pathankot? In my point of view this is silly thing.</p><p>If you really want to give tribute them, go to their home ask their family how can we help and support them. Share something on social sites which encourage people to join Indian Army/Airforce/Navy any of these. Help security forces anyhow you can.</p><p>Many people think they have degree in engineering or medical or business or etc . how can they join Indian security forces. They think this service is not for them because they have degree in higher studies. I am just asking if engineers can be an actor, a writer, a musician, a singer, a photographer then why not soldiers.</p><p>I saw lots of people wrote soldiers are real hero but no one has any selfie with any Indian soldiers. If they are real hero then why do you never ask them for autograph/selfie.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b30e6c4cdc92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[good talk given by Shashi Tharoor for emerging India.]]></title>
            <link>https://medium.com/@vksgupta44/good-talk-given-by-shashi-tharoor-for-emerging-india-2ece6b7c3bd1?source=rss-2d77bdb7de9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ece6b7c3bd1</guid>
            <category><![CDATA[business]]></category>
            <category><![CDATA[trends]]></category>
            <category><![CDATA[inspiration]]></category>
            <dc:creator><![CDATA[VIKASH GUPTA]]></dc:creator>
            <pubDate>Sun, 13 Sep 2015 06:05:01 GMT</pubDate>
            <atom:updated>2015-09-13T06:05:01.434Z</atom:updated>
            <content:encoded><![CDATA[<p>good talk given by Shashi Tharoor for emerging India.</p><p>Link: <a href="https://www.youtube.com/watch?v=kcW4ABcY3zI">https://www.youtube.com/watch?v=kcW4ABcY3zI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ece6b7c3bd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>