Skip to content

Commit

Permalink
Merge branch 'develop' into issue_4356_group_delete_docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
ltalirz authored Nov 11, 2020
2 parents 1d061a6 + c42a86b commit 2830206
Show file tree
Hide file tree
Showing 570 changed files with 16,368 additions and 14,335 deletions.
29 changes: 29 additions & 0 deletions .ci/docker-rabbitmq.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# A small configuration for use in local CI testing,
# if you wish to control the rabbitmq used.

# Simply install docker, then run:
# $ docker-compose -f .ci/docker-rabbitmq.yml up -d

# and to power down, after testing:
# $ docker-compose -f .ci/docker-rabbitmq.yml down

# you can monitor rabbitmq use at: http://localhost:15672

version: '3.4'

services:

rabbit:
image: rabbitmq:3.8.3-management
container_name: aiida-rmq
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- '5672:5672'
- '15672:15672'
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 5
19 changes: 9 additions & 10 deletions .ci/polish/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ def launch(expression, code, use_calculations, use_calcfunctions, sleep, timeout
valid, error = validate(expression)

if not valid:
click.echo("the expression '{}' is invalid: {}".format(expression, error))
click.echo(f"the expression '{expression}' is invalid: {error}")
sys.exit(1)

filename = 'polish_{}.py'.format(str(uuid.uuid4().hex))
filename = f'polish_{str(uuid.uuid4().hex)}.py'
evaluated = evaluate(expression, modulo)
outlines, stack = generate_outlines(expression)
outlines_string = format_outlines(outlines, use_calculations, use_calcfunctions)
write_workchain(outlines_string, filename=filename)

click.echo('Expression: {}'.format(expression))
click.echo(f'Expression: {expression}')

if not dry_run:
try:
workchain_module = 'polish_workchains.{}'.format(filename.replace('.py', ''))
workchain_module = f"polish_workchains.{filename.replace('.py', '')}"
workchains = importlib.import_module(workchain_module)
except ImportError:
click.echo('could not import the {} module'.format(workchain_module))
click.echo(f'could not import the {workchain_module} module')
sys.exit(1)

inputs = {'modulo': Int(modulo), 'operands': Str(' '.join(stack))}
Expand All @@ -153,26 +153,25 @@ def launch(expression, code, use_calculations, use_calcfunctions, sleep, timeout
if timed_out:
click.secho('Failed: ', fg='red', bold=True, nl=False)
click.secho(
'the workchain<{}> did not finish in time and the operation timed out'.format(workchain.pk),
bold=True
f'the workchain<{workchain.pk}> did not finish in time and the operation timed out', bold=True
)
sys.exit(1)

try:
result = workchain.outputs.result
except AttributeError:
click.secho('Failed: ', fg='red', bold=True, nl=False)
click.secho('the workchain<{}> did not return a result output node'.format(workchain.pk), bold=True)
click.secho(f'the workchain<{workchain.pk}> did not return a result output node', bold=True)
sys.exit(1)

else:
results, workchain = run_get_node(workchains.Polish00WorkChain, **inputs)
result = results['result']

click.echo('Evaluated : {}'.format(evaluated))
click.echo(f'Evaluated : {evaluated}')

if not dry_run:
click.echo('Workchain : {} <{}>'.format(result, workchain.pk))
click.echo(f'Workchain : {result} <{workchain.pk}>')

if result != evaluated:
click.secho('Failed: ', fg='red', bold=True, nl=False)
Expand Down
10 changes: 5 additions & 5 deletions .ci/polish/lib/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def validate(expression):
try:
symbols = expression.split()
except ValueError as exception:
return False, 'failed to split the expression into symbols: {}'.format(exception)
return False, f'failed to split the expression into symbols: {exception}'

while len(symbols) > 1:
try:
Expand All @@ -85,19 +85,19 @@ def validate(expression):
try:
operand = int(operand)
except ValueError:
return False, 'the operand {} is not a valid integer'.format(operand)
return False, f'the operand {operand} is not a valid integer'

if operator not in OPERATORS.keys():
return False, 'the operator {} is not supported'.format(operator)
return False, f'the operator {operator} is not supported'

if OPERATORS[operator] is operators.pow and operand < 0:
return False, 'a negative operand {} was found for the ^ operator, which is not allowed'.format(operand)
return False, f'a negative operand {operand} was found for the ^ operator, which is not allowed'

# At this point the symbols list should only contain the initial operand
try:
operand = int(symbols.pop())
except ValueError:
return False, 'the operand {} is not a valid integer'.format(operand)
return False, f'the operand {operand} is not a valid integer'

if symbols:
return False, 'incorrect number of symbols found, should contain N operands followed by (N - 1) operators'
Expand Down
6 changes: 3 additions & 3 deletions .ci/polish/lib/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ def write_workchain(outlines, directory=None, filename=None):

outline_string = ''
for subline in outline.split('\n'):
outline_string += '\t\t\t{}\n'.format(subline)
outline_string += f'\t\t\t{subline}\n'

if counter == len(outlines) - 1:
child_class = None
else:
child_class = 'Polish{:02d}WorkChain'.format(counter + 1)
child_class = f'Polish{counter + 1:02d}WorkChain'

subs = {
'class_name': 'Polish{:02d}WorkChain'.format(counter),
'class_name': f'Polish{counter:02d}WorkChain',
'child_class': child_class,
'outline': outline_string,
}
Expand Down
Loading

0 comments on commit 2830206

Please sign in to comment.