Bug 245506

Summary: biology/linux-foldingathome: Improve startup script, join "Team FreeBSD" by default
Product: Ports & Packages Reporter: Michael Gmelin <grembo>
Component: Individual Port(s)Assignee: Mateusz Piotrowski <0mp>
Status: Closed FIXED    
Severity: Affects Only Me CC: rhurlin
Priority: --- Flags: bugzilla: maintainer-feedback? (0mp)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch to improve startup script and join Team FreeBSD automatically 0mp: maintainer-approval+

Description Michael Gmelin freebsd_committer freebsd_triage 2020-04-10 15:39:13 UTC
Created attachment 213247 [details]
Patch to improve startup script and join Team FreeBSD automatically

This patch brings a couple of improvements:

- `fahclient_log' is now passed in the --log parameter to
  FAHClient, so that the log file is actually written in
  the location `service fahclient log' is looking in.
- `fahclient_donor' can be set to specify the user to attribute
  the work units processed to. If the user already has a donor
  configured in config.xml, that setting take precedence
  (following the POLA principle). It defaults to `Anonymous'.
- `fahclient_team' can be set to specify the team to attribute
  the work units processed to. If the user already has a team
  configured in config.xml, that setting take precedence
  (following the POLA principle). It defaults to the Team ID
  of "Team FreeBSD".
- `fahclient_extra_flags' can be used to specify additional
  settings to be passed to FAHClient (`fahclient_flags' also works,
  but anything set in there can be overriden in config.xml. FAHClient
  will warn in such cases).
- New command `service fahclient showconfig' can be used
  to see the actual settings that FAHClient is using.
- Using --option=value syntax to reduce fallout in case a
  setting wasn't configured properly.
- Document all settings on top of the rc file.

As a result, configuring the port is quite comfortable:

    service fahclient enable
    service fahclient start

will start FAHClient as Anonymous, contributing to "Team FreeBSD".

    sysrc fahclient_user=that_folding_guy
    sysrc fahclient_team=12171
    sysrc fahclient_extra_flags+=" --cpus=7"
    service fahclient restart

will send work units as donor `that_folding_guy', member of an
alternative team named "FreeBSD", utilizing up to 7 CPUs.

    service fahclient showconfig | grep cpus

will give the peace of mind that the setting caught on.
Comment 1 Mateusz Piotrowski freebsd_committer freebsd_triage 2020-04-14 14:48:46 UTC
Comment on attachment 213247 [details]
Patch to improve startup script and join Team FreeBSD automatically

>Index: biology/linux-foldingathome/files/fahclient.in

>...

>+# fahclient_team (str):		Default: "11743" (FreeBSD Team)
>+#				Team to attribute work units to.

I've tried to do it in the past but I could get the command line client to accept the team argument. I'm super happy you've managed to get this working.

>...

>+# - --user sets the donor work units are attributed to (config file takes
>+#   precedence)
>+# - --team sets the team work units are attributed to (cfg file takes
>+#   precedence)

There are missing periods at the end of those sentences.

> ...
 
>-3.	Consider setting the user name and the team ID (e.g., "11743")
>-	in %%FAHCLIENT_CONFIG_XML%%.
>+3.	Enable the fahclient service:
> 
>-4.	Enable the fahclient service:
>+		sysrc fahclient_enable=YES
> 
>-		sysrc fahclient_enable="YES"
>+4.	Consider setting the user name and the team ID

Missing colon.

> 
>+		sysrc fahclient_user=myusername
>+		sysrc fahclient_team=0
>+
>+	Team 0 means "no team", by default fahclient joins team FreeBSD (11743)

Missing period.

>+
> 5.	Start the service:
> 
> 		service fahclient start
>@@ -40,10 +44,10 @@
> 	Note, that usually the permissions are on unless the system
> 	configuration was modified by the administrator.
> 
>--	The ID of the FreeBSD team is 11743. In order to join the team
>-	add the following line to %%FAHCLIENT_CONFIG_XML%%:
>+-	By default the FreeBSD team (team id 11743) is joined.
>+	This can be overridden changing the configuration in rc.conf:

Typo? s/overridden/overridden by/

> 
>-		<team value="11743"/>
>+		sysrc fahclient_team=0
> 
> 	The service has to be restarted to pick up the change.
> 
>@@ -50,6 +54,25 @@
> 	Statistics for the FreeBSD team can be viewed here:
> 	https://stats.foldingathome.org/team/11743
> 
>+-	Team and donor configuration values in %%FAHCLIENT_CONFIG_XML%% take
>+	precedence over those configured in rc.conf using sysrc.
>+
>+-	You can specify additional flags in rc.conf. Those take precedence

I've tried to avoid addressing the user directly as it is usually the preferred  style in our manual pages and handbooks, but I am not going to block this patch because of this minor thing. It's up to you.

Otherwise, it seems pretty solid so if you've got this new service tested, you've got my approval! Thanks a lot!
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-04-14 16:04:03 UTC
A commit references this bug:

Author: grembo
Date: Tue Apr 14 16:03:25 UTC 2020
New revision: 531701
URL: https://svnweb.freebsd.org/changeset/ports/531701

Log:
  Improve startup script, join "Team FreeBSD" by default

  PR:		245506
  Approved by:	0mp (maintainer)

Changes:
  head/biology/linux-foldingathome/Makefile
  head/biology/linux-foldingathome/files/fahclient.in
  head/biology/linux-foldingathome/files/pkg-message.in
Comment 3 Michael Gmelin freebsd_committer freebsd_triage 2020-04-14 16:07:45 UTC
(In reply to Mateusz Piotrowski from comment #1)

> I've tried to avoid addressing the user directly as it is usually the
> preferred style in our manual pages and handbooks, but I am not going
> to block this patch because of this minor thing. It's up to you.

I incorporated all your changes (including being consistent about not
addressing the user directly). Thanks for the QA!

> Otherwise, it seems pretty solid so if you've got this new service tested,
> you've got my approval! Thanks a lot!

150 WUs and counting :)
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-04-14 16:55:09 UTC
A commit references this bug:

Author: grembo
Date: Tue Apr 14 16:54:34 UTC 2020
New revision: 531706
URL: https://svnweb.freebsd.org/changeset/ports/531706

Log:
  Correct typo in pkg-message.

  Accidentally documented fahclient_donor as fahclient_user, which has
  a different meaning.

  PR:		245506

Changes:
  head/biology/linux-foldingathome/files/pkg-message.in