Hydra - Specifying config group with a keyword other than the directory - fb-hydra

Say I have the following file structure:
|--configs
| |--config.yaml
| |--A
| |--conf1.yaml
| |--conf2.yaml
| |--conf3.yaml
|--main_app.py
and my base config.yaml looks like
defaults:
A: conf1
If I want to run some other config like conf2 or conf3, I can simply run
python main_app.py A=conf2
What I am trying to do is to somehow use a different keyword from the directory name to specify this config above. For example,
python main_app.py B=conf2
For reasons I can't explain, it is not possible for me to change the directory name from A to B. However, I would find the behavior I described above desirable since B is a way more descriptive keyword than the directory name A. Is something like this possible? Thank you!

If you are using Linux you can create a symbolic link.
Hydra itself does not support this.

Related

How to list contents of another directory without being in it?

Here is what my directory looks like:
Test ----
|
|----One
|
|----Two
I am attempting to list the contents of Two while still being in One and I am not able to do so.
I have tried this command (as seen in a other post) : "ls Test/" and it says No such file or directory. I have also tried ls Test/Two/ and it still does not work.
If you are in One and you want to list the contents of Two, you should go up to the parent directory using ..:
ls ../Two
../ will place you in the Test directory, from there, you can go to Two with no problem. If you have more depth levels, just add more ../ to go up one directory each time, but mind which is your current directory when running the command.
what does this command provide you in terminal.
ls -al Test //a flag is used for hidden file

Can Robot Framework Support External Variables?

I am trying to create a central file that houses all the variables that we use in our test cases (for instance, the ${BROWSER} variable).
I have also created a central file for a lot of custom defined keywords and I am trying to use the central variable file as a resource for the central keywords file...modularization so to speak
The keywords however do not run as the variables from the central file are not being recognized.
So my question is, has anyone achieved calling external variables in a RF test resource/case successfully? And if so, could you please explain how you did it?
Thank you!
There are several ways, all documented in the Robot Framework Users Guide.
Using command line arguments
You can define variables on the command line using command line options (--variable) option. For example:
pybot --variable FOO:hello mysuite.robot
You can define multiple variables by putting the variables in an argument file, and then you can include the argument file on the command line with the --argumentfile option.
For example, you could create a file named "variables.args" that looks like this:
--variable FOO:Hello
--variable BAR:World
You could then use this file on the command line like this:
pybot --argumentfile variables.args mysuite.robot
My team relies on this heavily. We have two classes of argument files: environments and scenarios. In an environment file we put URLs, usernames, passwords, etc. that are unique to that environment. In the scenario file we'll put things unique to that scenario, such as the definition of ${BROWSER}, the suites to run, etc. Then, our pybot command is very simple: `pybot --argumentfile environment/qa1.args --argumentfile scenarios/chrome_smoke_test.args
Using variable files
If your central file is a python script, you can access all the variables by including the file in your settings. These are called variable files.
For example, you could create a filenamed "variables.py" that looks like this:
FOO = "Hello"
BAR = "World"
You could then use that file in a test suite like this:
*** Settings ***
| Variables | variables.py
*** Test Cases ***
| Example
| | Should be equal | ${FOO} | Hello
| | Should be equal | ${BAR} | World
Using Resource files
Another method is to define your variables in resource files. Resource files allow you to use robot syntax to define variables.
For example, you could create a file named "variables.robot" like this:
*** Variables ***
| ${FOO} | Hello
| ${BAR} | World
You would then include it in a test like this:
*** Settings ***
| Resource | Variables.robot
*** Test Cases ***
| Example
| | Should be equal | ${FOO} | Hello
| | Should be equal | ${BAR} | World
Using environment variables
Another way to use external variables is to define environment variables. Environment variables can be accessed using a % rather than $ when accessing the variable.
For example, assuming you've defined the environment variable HOME, you can access it within in your test as %{HOME}.

Copy folders to new folder with different ending

I have a huge number of folders all with different names but same ending.
Like this:
blabla_ending1
Now I want to copy all those folders and give them another ending (ending2). I tried this but it did not work like I want to:
cp -r *_ending1 *_ending2
Somehow I need to specify that the second * depends on the first one. Maybe I am also unaware of the precise meaning of *. I know its very basic but I could not find any help yet.
I can't think of a simple command to achieve that. However, the following will achieve the desired result:
for path in *_ending1; do
newpath=`echo $path | sed 's/_ending1$/_ending2/'`
cp -r $path $newpath
done

Find missing URL routes using the command-line

I'm trying to automate a check for missing routes a Play! web application.
The routing table is in a file in the following format:
GET /home Home.index
GET /shop Shop.index
I've already managed to use my command line-fu to crawl through my code and make a list of all the actions that should be present in the file. This list is in the following format:
Home.index
Shop.index
Contact.index
About.index
Now I'd like to pipe the output of this text into another command that checks if each line is present in the route file. I'm not sure how to proceed though.
The result should be something like this:
Contact.index
About.index
Does someone have a helpful suggestion on how I can accomplish this?
try this line:
awk 'NR==FNR{a[$NF];next}!($0 in a)' routes.txt list.txt
EDIT
if you want the above line to accept list from stdin:
cat list.txt|awk 'NR==FNR{a[$NF];next}!($0 in a)' routes.txt -
replace cat list.txt with your magic command

making a dicomdir-File useing dcmtk: useing "absolute" Path?

I want to create a dicmdir file using dcmmkdir where the file-path isn't the same as the dicomdir-path.
Example:
File stored in C:\Dicompath
Dicomdir should be stored in H:\tmp
dcmmkdir -v +r -Pmi +D H:\tmp\ +id C:\Dicompath\
Does anybody know what I have to do getting my vision?
thanks
GGK
According to the documentation for the associated dcmgpdir application, you need to specify a file name with the +D option. For most reliable outcome, I also believe you need to specify a (dummy) file name pattern with option +p:
dcmmkdir -v +r -Pmi +D H:\tmp\DICOMDIR +id C:\Dicompath\ +p *.*

Resources