User's banner
Avatar

bahmanm

bahmanm@lemmy.ml
Joined
74 posts โ€ข 79 comments

Husband, father, kabab lover, history buff, chess fan and software engineer. Believes creating software must resemble art: intuitive creation and joyful discovery.

๐ŸŒŽ linktr.ee/bahmanm

Views are my own.

Direct message

UPDATE: lemmy.ml is now on lemmy-meter ๐Ÿฅณ

permalink
report
reply

Can you provide what you mean by check the environment, and why youโ€™d need to do that before anything else?

One recent example is a makefile (in a subproject), w/ a dozen of targets to provision machines and run Ansible playbooks. Almost all the targets need at least a few variables to be set. Additionally, I needed any fresh invocation to clean the โ€œbuildโ€ directory before starting the work.

At first, I tried capturing those variables w/ a bunch of ifeqs, shells and defines. However, I wasnโ€™t satisfied w/ the results for a couple of reasons:

  1. Subjectively speaking, it didnโ€™t turn out as nice and easy-to-read as I wanted it to.
  2. I had to replicate my (admittedly simple) clean target as a shell command at the top of the file.

Then I tried capturing that in a target using bmakelib.error-if-blank and bmakelib.default-if-blank as below.

##############

.PHONY : ensure-variables

ensure-variables : bmakelib.error-if-blank( VAR1 VAR2 )
ensure-variables : bmakelib.default-if-blank( VAR3,foo )

##############

.PHONY : ansible.run-playbook1

ansible.run-playbook1 : ensure-variables cleanup-residue | $(ansible.venv)
ansible.run-playbook1 : 
	...

##############

.PHONY : ansible.run-playbook2

ansible.run-playbook2 : ensure-variables cleanup-residue | $(ansible.venv)
ansible.run-playbook2 : 
	...

##############

But this was not DRY as I had to repeat myself.

Thatโ€™s why I thought there may be a better way of doing this which led me to the manual and then the method I describe in the post.


running specific targets or rules unconditionally can lead to trouble later as your Makefile grows up

That is true! My concern is that when the number of targets which donโ€™t need that initialisation grows I may have to rethink my approach.

Iโ€™ll keep this thread posted of how this pans out as the makefile scales.


Even though Iโ€™ve been writing GNU Makefiles for decades, I still am learning new stuff constantly, so if someone has better, different ways, Iโ€™m certainly up for studying them.

Love the attitude! Iโ€™m on the same boat. I could have just kept doing what I already knew but I thought a bit of manual reading is going to be well worth it.

permalink
report
parent
reply

Thanks. At least Iโ€™ve got a few clues to look for when auditing such code.

permalink
report
parent
reply

Update 1

ttrpg.network is now on lemmy-meter ๐Ÿฅณ Thanks for your interest ๐Ÿ™

permalink
report
reply

To be precise, itโ€™s not 4 requests to the same endpoint.

lemmy-meter probes 4 endpoints each once per minute:

  • The landing page
  • api.getPosts (limit=1)
  • api.getComments (limit=1)
  • api.getCommunities (limit=1)

Thatโ€™s b/c Iโ€™ve frequently experienced cases when the landing page works but some mobile APIs donโ€™t and vice versa.

Hope that makes sense.


As I said, if after some time you feel like this is too much load, reach out to me and I can easily configure lemmy-meter to probe less frequently.

permalink
report
parent
reply

Something that Iโ€™ll definitely keep an eye on. Thanks for sharing!

permalink
report
reply

NB: I have never had the fortune to write Lisp in a professional setup.

For years, I used to use SBCL snippets for a whole set of automation tasks in my daily workflow, like updating git repos in batch, checking failing CI/CD pipelines per repo, organising my music collection, etc.

But gradually I switched to more specialised tools and, yes, Emacs Lisp to do what I needed to do. It just felt more ergonomic in my case.

The last time I seriously used SBCL was to solve some of Project Eulerโ€™s challenges back in 2018: https://github.com/bahmanm/euler-cl

Nowadays, Iโ€™ve got no non-elisp code left ๐Ÿ™‚ ๐Ÿคทโ€โ™‚๏ธ

permalink
report
reply

First off, I was ready to close the tab at the slightest suggestion of using Velocity as a metric. That didnโ€™t happen ๐Ÿ™‚


I like the idea that metrics should be contained and sustainable. Though I donโ€™t agree w/ the suggested metrics.

In general, it seems they are all designed around the process and not the product. In particular, thereโ€™s no mention of the โ€œvalue unlockedโ€ in each sprint: itโ€™s an important one for an Agile team as it holds Product accountable to understanding of what is the $$$ value of the teamโ€™s effort.

The suggested set, to my mind, is formed around the idea of a feature factory line and its efficiency (assuming it is measurable.) It leaves out the โ€œmeaningโ€ of what the team achieve w/ that efficiency.

My 2 cents.


Good read nonetheless ๐Ÿ‘ Got me thinking about this intriguing topic after a few years.

permalink
report
reply

This is fantastic! ๐Ÿ‘

I use Perl one-liners for record and text processing a lot and this will be definitely something I will keep coming back to - Iโ€™ve already learned a trick from โ€œContext Matchingโ€ (9) ๐Ÿ™‚

permalink
report
reply

Update 1

Thanks all for your feedback ๐Ÿ™ I think everybody made a valid point that the OOTB configuration of 33 requests/min was quite useless and we can do better than that.

I reconfigured timeouts and probes and tuned it down to 4 HTTP GET requests/minute out of the box - see the configuration for details.


๐ŸŒ A pre-release version is available at lemmy-meter.info.

For the moment, it only probes the test instances


Iโ€™d very much appreciate your further thoughts and feedback.

permalink
report
reply